Debian

How to install Cassandra on Debian 11

Cassandra or Apache Cassandra is an open-source NoSQL database initially developed by Facebook but later moved on to Apache license; therefore, it is now known as Apache Cassandra as well. The NoSQL databases are primarily used to compete in the current technology era by providing support to process graphical content, videos. As Cassandra belongs to the NoSQL category, it stores data in the form of key value pairs and uses its own query retrieving language known as CQL (Cassandra Query Language). The outermost shell of Cassandra is known as Cluster and it consists of several nodes, nodes are just the instance of Cassandra running on a machine.

How to install Cassandra on Debian 11

This section provides a procedural guide to install Cassandra on your Debian 11; let’ start this guide by defining some prerequisites:

Prerequisites

The following list contains the initial mandatory steps to be carried out before installation:

  • Latest version of Java
  • Access to Apache Cassandra repository

The first few steps refer to getting the above-mentioned prerequisites:

Step 1: Install latest Java on Debian 11

Apache Cassandra requires latest version of Java to be present on your Debian 11; so, if you do not have it; use the following command to get latest Java:

$ sudo apt install default-jdk

To verify the successful installation of Java, you can check the version of installed Java by issuing the command mentioned below:

$ java -version

Step 2: Add Cassandra repository

To add the Apache Cassandra repository; you must have the GPG key to add the repository to Debian 11; execute the following command in terminal to download GPG key for secure connection:

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

Once the GPG key is added; you are ready to add the Cassandra repository by issuing the below mentioned command:

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

Step 3: Install Apache Cassandra

After completing the prerequisites, you can now finally proceed to installation of Cassandra on Debian 11. But before this update the packages list of Debian 11 by using the command written below:

$ sudo apt update

After updating, install the Apache Cassandra by issuing the following command:

$ sudo apt install cassandra

Step 4: Verify the installation and connect to Cassandra

You can check the status of Cassandra service to verify its installation; for this, use the tbe mentioned command:

$ sudo systemctl status cassandra

After that, you can also check the status of Cassandra clusters by issuing the command mentioned below:

The “UN” mark in the output shows that the cluster is “UP” and running “Normal

$ sudo nodetool status

Conclusion

Debian being a well-known distro of an open-source Operating System Linux provides extensive support to access several databases. Databases are the key component in store and manipulate data by using any query language. SQL and NoSQL databases are used to store data in tabular restrict form and in document form respectively. Apache Cassandra refers to a NoSQL type of database that uses key value pairs to store data and CQL is used by Cassandra to manipulate data. The Cassandra service can store and handle huge amounts of data on several servers. In this post, we have provided a demonstration to install Apache Cassandra on Debian 11 alongside its connection as well. Moreover, for novice users, this guide also provides an  insight into the basics of Cassandra as well.

About the author

Adnan Shabbir