Install Apache Cassandra 3.11.4 using YUM repo on CentOS 7.6

DataXSchool Learning Center
3 min readApr 11, 2023

How to Install Apache Cassandra 3.11.4 on CentOS 7.6

Apache Cassandra is a free and open source NoSQL database management system that is designed to provide scalability, high availability, and uncompromised performance.

In this article, I will guide you through installing the latest stable release of Apache Cassandra, Apache Cassandra 3.11.2, on a CentOS 7 server instance.

Prerequisites

Step 1: Install OpenJDK JRE 8

Apache Cassandra requires the latest release of Java 8. For that you can choose to install the latest release of OpenJDK JRE 1.8 as below:

sudo yum install -y java-1.8.0-openjdk

Having OpenJDK JRE 1.8 installed, you can confirm the installation result:

java -version

The output will be similar to the following:

openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)

Optionally, you can create the JAVA_HOME environment variable as follows:

echo "JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")" | sudo tee -a /etc/profile
source /etc/profile
echo $JAVA_HOME

Step 2: Install Python 2.7, if it’s missing on your system

Apache Cassandra requires Python 2.7 rather than Python 3. If you operate Apache Cassandra in a Python 3 environment, you may have trouble launching the cqlsh shell of Apache Cassandra.

First, determine the existence and version of Python on your machine:

python -V

On CentOS 7, the output normally will be:

Python 2.7.5

As you see, Python 2.7 is a built-in component on CentOS 7. However, if it’s missing for some reason, you can install it by running the following command:

sudo yum install python -y

Step 3: Install the latest stable release of Apache Cassandra

Create the Apache Cassandra 3.11.x YUM repo:

cat <<EOF | sudo tee -a /etc/yum.repos.d/cassandra311x.repo
[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
EOF

Install Apache Cassandra 3.11.2 using the above YUM repo:

sudo yum install cassandra -y
sudo systemctl daemon-reload

Step 4: Test the installation of Apache Cassandra

Start the Apache Cassandra daemon:

sudo service cassandra start

The output will be:

Starting cassandra (via systemctl):                        [  OK  ]

If you want to make Apache Cassandra automatically start at system boot, run the following command:

sudo chkconfig cassandra on

Next, use the nodetool program to show the status of Apache Cassandra on current node:

nodetool status

The output will resemble the following:

Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 127.0.0.1 103.65 KiB 256 100.0% e977023b-7dd7-4e89-9ee7-aaa4c45df51c rack1

You can use the cqlsh shell to interact with Apache Cassandra:

cqlsh localhost

The output will be similar to the following:

Connected to Test Cluster at localhost:9042.
[cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>

For now, just type exit and then press ENTER to quit the cqlsh shell.

If you want to stop Apache Cassandra, execute the following command:

sudo service cassandra stop

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

DataXSchool Learning Center
DataXSchool Learning Center

Written by DataXSchool Learning Center

Helping student to get job in nosql databases (Cassandra, MongoDB, Neo4J,Redis)

No responses yet

Write a response