How to Install Apache Cassandra on Ubuntu 22.04

There are two types of database management systems, one is an SQL database and another one is a NoSQL database. Cassandra is the NoSQL database that can store and handle a bulk amount of data. Moreover, if any node of the Cassandra is failed, it is replaced within no time, the developer team of the Cassandra is working on adding more features without compromising the quality.

The Apache Cassandra can be installed on the Linux distributions and in this article, we will explore the method of installing the Apache Cassandra on Ubuntu 22.04.

How to install Apache Cassandra on Ubuntu 22.04

To install the Apache Cassandra on Ubuntu 22.04, we will use its official repository and with the help of the apt package manager, we will install it. Firstly, we will update packages list on the Ubuntu 22.04 with the update command:

$ sudo apt update

As Apache Cassandra is written in Java so we need to have Java installed on our machine. To install Java, use:

$ sudo apt install default-jdk -y

After the Java package is installed, we will import the GPG keys using the command:

$ wget -q -O - https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -

After importing the key of the Cassandra, we will add the repository of the Apache Cassandra in the default sources list of Ubuntu using the command:

$ sudo sh -c 'echo "deb https://www.apache.org/dist/cassandra/debian 40x main" > /etc/apt/sources.list.d/cassandra.list'

Then we will update the Ubuntu using the command:

$ sudo apt update

Apache Cassandra is ready to install on the Ubuntu, so we will use the command:

$ sudo apt install cassandra -y

To check the status of the installed Cassandra, we will use the command:

$ sudo systemctl status cassandra

How to access the Apache Cassandra on the Ubuntu 22.04

By default, the directory of the Apache Cassandra is located at /etc/cassandra, data will be stored at /var/lib/cassandra and to access the Apache Cassandra, we will use the command:

$ cqlsh

In the above output, we can observe that the cluster name is set to the “Test Cluster”, which can be changed to the “Linuxhint Cluster”, by using the command:

UPDATE system.local SET cluster_name = ‘LinuxHint Cluster’ WHERE KEY = ‘local’;

And then we will exit the Apache database using:


Now the time is to change the name to “LinuxHint” in the configuration files by using the command:

$ sudo nano /etc/cassandra/cassandra.yaml

In the open file, replace the “Test Cluster” with the “LinuxHint Cluster”:

Finally, we will restart the Apache Cassandra:

$ sudo systemctl restart cassandra

And open the Cassandra database using the command:

$ cqlsh

Now we can see that the name has been changed and if we want to delete the Apache Cassandra then we can do so by using the command:

$ sudo apt purge cassandra -y


The Apache Cassandra is a NoSQL database which can handle a large amount of the data quite conveniently. In this write-up, the Apache Cassandra has been installed on the latest release of the Ubuntu which is 22.04 using the terminal, and also learned the method of changing the cluster name of Cassandra.

About the author

Hammad Zahid

I'm an Engineering graduate and my passion for IT has brought me to Linux. Now here I'm learning and sharing my knowledge with the world.