FedoraRHEL Based

How To Install Apache Cassandra on Fedora 39

Install Apache Cassandra on Fedora 39

In this tutorial, we will show you how to install Apache Cassandra on Fedora 39. Apache Cassandra is a highly scalable, high-performance distributed NoSQL database designed to handle large amounts of structured data across commodity servers. Cassandra offers strong consistency and high availability by replicating data across multiple nodes with no single point of failure.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Apache Cassandra on a Fedora 39.

Prerequisites

Before diving into the installation process, let’s ensure that you have everything you need:

  • A server running one of the following operating systems: Fedora 39.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • You will need access to the terminal to execute commands. Fedora 39 provides the Terminal application for this purpose. It can be found in your Applications menu.
  • A network connection or internet access to download the Apache Cassandra repository.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Apache Cassandra on Fedora 39

Step 1. Before installing Cassandra, it’s crucial to update your system. This ensures that all existing packages are up-to-date, and the system repo cache is refreshed. To update Fedora 39, use the following command:

sudo dnf clean all
sudo dnf update

Step 2. Installing Java.

Cassandra is written in Java, so we need to make sure that Java is installed on our Rocky Linux system. Now run the following command below to install Java:

sudo dnf install java-11-openjdk

Verify the Java version by running:

java -version

Step 3. Installing Python.

Fedora usually comes with Python pre-installed. To check the version, open the terminal and type:

python --version

If Python is installed, the version number will be displayed.

If your system doesn’t have Python or you want to upgrade to the latest version, you can download it from the official Python website. However, Fedora 39 includes a tool called ‘dnf‘ that simplifies the process. To install Python 3, type:

sudo dnf install python3

To verify the installation, type:

python3 --version

Step 4. Installing Apache Cassandra on Fedora 39

The first step is to add the official Apache Cassandra repository from Apache to YUM. This repository contains the latest 4.1 version RPM packages specifically built for Fedora.

Create a new YUM repo file /etc/yum.repos.d/cassandra.repo with the following configuration:

[cassandra]
name = Apache Cassandra
baseurl = https://downloads.apache.org/cassandra/redhat/41x/
gpgcheck = 1
repo_gpgcheck = 1
gpgkey = https://downloads.apache.org/cassandra/KEYS

This repository definition contains the base URL to download the Cassandra 4.1 RPM packages. GPG check is enabled to verify the packages‘ signatures. Save and close this file once added.

With the repository configured, install the Apache Cassandra package using the DNF package manager:

sudo dnf update
sudo dnf install cassandra

Confirm that Cassandra is now installed:

$ cassandra -v
Apache Cassandra 4.1.0

The main package to install is cassandra. Additional Python driver packages can also be installed:

sudo dnf install python-cql python3-cql

Once Cassandra is installed, start the service and enable automatic startup on boot using systemctl:

sudo systemctl start cassandra
sudo systemctl enable cassandra

Step 5. Verify the Cassandra Installation.

Verify that Cassandra is installed correctly and can be accessed through cqlsh:

cqlsh

Output:

Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 6.0.0 | Cassandra 4.1.0 | CQL spec 3.4.5 | Native protocol v5]
Use HELP for help.

This will connect to the running Cassandra instance using the native query language shell. Run a few sample CQL statements to check connectivity:

DESCRIBE KEYSPACES;
SELECT cluster_name, listen_address FROM system.local;

If cqlsh connects and runs queries successfully, your Cassandra installation is working!

Step 6. Post-Installation Configuration.

Cassandra Configuration File.

The core configuration file is /etc/cassandra/default.conf/cassandra.yaml. This controls the cluster name, data storage locations, JVM settings, backups, security, and more. Some common settings to configure include:

  • Cluster name
  • Listen to address
  • Seed node IP addresses
  • Data file directories
  • Commit log directory
  • Authenticator and authorizer

Make any changes to cassandra.yaml and restart the service for settings to take effect.

Cassandra Data Storage.

By default, Cassandra’s table data is stored under /var/lib/cassandra/data while commit logs are under /var/lib/cassandra/commitlog.

These storage locations can be customized in cassandra.yaml. Ensure your data disks have sufficient IOPS and throughput to handle read/write operations. SSDs are best for fast performance.

Cassandra Logs.

Logs are essential for monitoring, auditing, and troubleshooting. Cassandra stores system.log, debug.log, and gc.log under /var/log/cassandra.

Rotate logs periodically and ship them to a centralized logging server for analysis. Log data can provide valuable insights into query patterns, performance issues, etc.

Congratulations! You have successfully installed Apache Cassandra. Thanks for using this tutorial for installing the Apache Cassandra on your Fedora 39 system. For additional or useful information, we recommend you check the official Apache website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button