How to install Apache Cassandra on Ubuntu?

Apache Cassandra is a free and open-source distributed NoSQL database management software. It is designed to handle a large amount of data efficiently. It provides high availability with no single point failure and allows linear scalability.

In this article, I will discuss how to install Apache Cassandra in Ubuntu.


To follow this guide you should have a system running Ubuntu( we are using Ubuntu 20.04 LTS) and access to a user account with root permissions.

How to install Apache Cassandra on Ubuntu

Apache Cassandra requires Java to be installed so before installing Cassandra first install Java on your system.

Installing Java

Use the following command to install Java

sudo apt install default jdk

Press y and then enter if it asks for your confirmation.

You can verify the installation by using the given command in your terminal –

java --version

java version

Installing Apache Cassandra

Import the public repository keys by using –

wget -q -O - | sudo apt-key add -

Next, add the Apache Casandra repository to the repository list –

echo deb 40x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list

Run the update command to refresh the package repository –

sudo apt update

Finally, use the given command to install Apache Cassandra on your system –

sudo apt install cassandra

Press y and then press the Enter if it asks for your confirmation.

You can check if Cassandra services are running or not by using the given command –

sudo systemctl status cassandra

status cassandra

Configuring Apache Cassandra

The data of Apache Cassandra is stored in the  /var/lib/cassandra directory. You can configure Cassandra by editing /etc/cassandra/cassandra.yml by default, it listens to only localhost if the client connecting to the database is also running on the same host then you don’t need to change the default configuration file.

For example, to rename the cluster name first open the configuration file by using a text editor –

sudo nano /etc/cassandra/cassandra.yaml

Find cluster_name and rename the cluster.

configure cassandra

You can explore and configure other options from this configuration file.

Once you make the changes in the Cassandra configuration file, restart the services to make the changes effective.

sudo systemctl restart cassandra

Test Cassandra command-line interface

The Cassandra comes with command-line tools you can communicate with database by using Cassandra Query Language (CQL).

To start a new shell run the following command in your terminal


cassandra command line

Now here you can run the Cassandra queries.


You have successfully set up Cassandra on your Ubuntu system. For more information, you can visit its documentation.

Now if you have a query then write us in the comments below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.