How to install Apache Cassandra on CentOS or Redhat

In this article, we will see how to install Apache Cassandra on CentOS or Redhat.

1. Java should be there on Linux machine to install Apache Cassandra. Lets verify java installed or not.

java -version

How to install Apache Cassandra on Redhat or CentOS

2. Install Java if not yet installed using below command.

sudo dnf install java-1.8.0-openjdk-devel

3. Now verify java installed or not.

[r2schools@localhost ~]$ java -version openjdk version "1.8.0_265" OpenJDK Runtime Environment (build 1.8.0_265-b01) OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)

4. After successful installation of java, we have to create Cassandra repository. Lets create by using below command:

sudo vi /etc/yum.repos.d/cassandra.repo

Then paste the below text:

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

Now save and exit the file.

5. Now, perform actual installation Apache Cassandra on Redhat or CentOS Linux disto with following command.

sudo dnf install cassandra

6. Lets verify Apache Cassandra installation by using below command.

rpm -qi cassandra

Output:

7. Now enable cassandra:

sudo systemctl enable cassandra

8. Start the Cassandra Service:

sudo systemctl start cassandra

9. Check the status of Cassandra service:

sudo systemctl status cassandra

Test the connection to Cassandra:

10. Connect to the Cassandra using cqlsh

where 3.11.8 is Cassandra verions
5.0.1 is the cqlsh version which means Cassandra query language shell.

Leave a Reply

Your email address will not be published. Required fields are marked *