How to install Apache Cassandra on Ubuntu 22.04

In this article, we will see how to install Apache Cassandra on Ubuntu 22.04 step by step.

Apache Cassandra is a high-performance opensource NoSQL database engine that provides fault tolerance, linear scalability, and consistency across multiple nodes. Apache Cassandra is ideal in IoT applications where massive data is collected. It also comes in handy in social media analytics, messaging services, and retail applications.

Among the companies that make use of Apache Cassandra include Netflix, Facebook, Cisco, Hulu, Deloitte, Bosch, Twitter, and many more.

Install Apache Cassandra on Ubuntu 22.04

Apache Cassandra needs OpenJDK 8 or 11 to run on an Ubuntu system.

1. First, we have to update packages in Ubuntu by running below command.

sudo apt-get update

How to install Apache Cassandra on Ubuntu 22.04

2. Now, install java jdk 8 or 11 by running below command.

sudo apt install openjdk-8-jdk -y or sudo apt install openjdk-11-jdk -y

3. Now, verify java version. It must be 8 or 11.

java --version

4. Now install APT transport package. we need to add this package to your system to enable access to the repositories using HTTPS.

sudo apt install apt-transport-https

Install Cassandra on Ubuntu Linux:

1. We need to add the Apache Cassandra repository and pull the GPG key before installing the database.

Enter the command below to add the Cassandra repository to the sources list:

echo "deb https://debian.cassandra.apache.org 40x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list

2. Next, Import the GPG key using following wget command as shown below.

curl https://downloads.apache.org/cassandra/KEYS | sudo apt-key add -

3. Again update the repositories:

sudo apt-get update

How to install Apache Cassandra on Ubuntu 22.04

4. Now, install Apache Cassandra on Ubuntu Linux using below command.

sudo apt install cassandra

Post Apache Cassandra Installation steps on Ubuntu Linux:

1. Check the status of Casdandra on Linux.

sudo systemctl status cassandra

2. Enable Apache Cassandra service to start after whenever Linux system restarts.

sudo systemctl enable cassandra

3. Now, connect to Cassandra on Linux by just running cqlsh command on the terminal.

4. If we want to check version of Cassandra installedo on Ubuntu Linux run the below command.

show version;

5. To exit from cassandra simply type exit; on cqlsh.

Leave a Reply

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