RHEL BasedRocky Linux

How To Install Apache Cassandra on Rocky Linux 9

Install Apache Cassandra on Rocky Linux 9

In this tutorial, we will show you how to install Apache Cassandra on Rocky Linux 9. For those of you who didn’t know, Apache Cassandra is a powerful and highly-scalable NoSQL database that is well-suited for use cases that require high write and read throughput. It is a distributed, masterless, and peer-to-peer database that is easy to scale and add new nodes to a cluster without disrupting the overall system.

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 open source NoSQL Database on Rocky Linux. 9.

Prerequisites

  • A server running one of the following operating systems: Rocky Linux 9.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Apache Cassandra.
  • 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 Rocky Linux 9

Step 1. The first step is to update your system to the latest version of the package list. To do so, run the following commands:

sudo dnf check-update
sudo dnf install dnf-utils

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

Use the following command to check whether Java is installed:

java -version

For additional resources on Java, read the post below:

Step 3. Installing Python.

You need to install Python as well since the cqlsh the tool is written in python. Cqlsh is a command-line interface for Cassandra; you’ll need to install Python to run Cassandra:

sudo dnf install python38

Next, install cqlsh using pip Python package manager:

pip3 install --user cqlsh

For additional resources on Python, read the post below:

Step 4. Installing Apache Cassandra on Rocky Linux 9.

By default, Apache Cassandra is not available on the Rocky Linux 9 AppStream repository. Now run the following command to add the Apache Cassandra repository to your system:

nano /etc/yum.repos.d/cassandra.repo

Add the following lines:

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

Save and close the file, then update the repository cache:

sudo dnf update

After the repository is added, we can install Cassandra. Run the following command to install it:

sudo dnf install cassandra

Once Cassandra is installed, we can start the service. Run the following command to start it:

sudo systemctl enable cassandra
sudo systemctl start cassandra

Step 5. Verify Installation.

To verify that Cassandra has been installed and started correctly, run the following command:

nodetool status

Output:

Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens  Owns (effective)  Host ID                               Rack
UN  127.0.0.1  46.12 KiB  16      100.0%            3De7fcci-Bgf9-4636-9bff-90d3tf10dc03  rack1

You can also use the cqlsh command to interact with your Cassandra cluster:

cqlsh

Step 6. Configure Cassandra.

The default location of configuration files for Cassandra is at /etc/cassandra. The default location for the log and data directories is /var/log/cassandra and /var/lib/cassandra.

In this file, you can configure various settings, such as the cluster name, seeds, listen address, data file directory, and more.

Congratulations! You have successfully installed Cassandra. Thanks for using this tutorial for installing Apache Cassandra NoSQL Database on your Rocky Linux 9 system. For additional help 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