How to install Apache Cassandra on Debian 11? – An Impressive NoSQL Database manager

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

This post is about how to install Apache Cassandra on Debian 11.

One of the most important NoSQL database solutions out there is Apache Cassandra. So in this post, you will learn how to install it on Debian 11.

Table of Content

Introduction to Apache Cassandra

According to the Apache Cassandra website:

Apache Cassandra is an open source NoSQL distributed database trusted by thousands of companies for scalability and high availability without compromising performance.

More explicitly, Apache Cassandra is a NoSQL database manager. This means that we will not have the data syntaxes like MySQL / MariaDB, but we will find CQL (Cassandra Query Language).

The way Cassandra stores data is through a key-value model. This means that first a key is defined and then the value of that key.

Thanks to the way Cassandra is designed, we can handle large amounts of data quickly and reliably. This is because Cassandra allows replication across many network data sources.

With this small introduction, we can start.

Install Apache Cassandra on Debian 11

Before getting started with Cassandra, we have to meet some requirements on the system. Let’s go for it.

Install Java on Debian 11

Cassandra is built with Java. This justifies the robustness of the application but makes it necessary to install it on the system.

Before doing anything, make sure your server is up-to-date using these commands.

sudo apt update
sudo apt upgrade

After this, you can install OpenJDK version 11 by running the following command

sudo apt install openjdk-11-jdk
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  ca-certificates-java fontconfig-config fonts-dejavu-core java-common libasound2 libasound2-data libavahi-client3 libavahi-common-data libavahi-common3 libcups2
  libdrm-amdgpu1 libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libfontconfig1 libgif7 libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0
  libglx0 libgraphite2-3 libharfbuzz0b libjpeg62-turbo liblcms2-2 libllvm11 libnspr4 libnss3 libpciaccess0 libpcsclite1 libsensors-config libsensors5 libvulkan1
  libx11-6 libx11-data libx11-xcb1 libxau6 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcb1 libxdamage1
  libxdmcp6 libxext6 libxfixes3 libxi6 libxrender1 libxshmfence1 libxtst6 libxxf86vm1 libz3-4 openjdk-11-jdk-headless openjdk-11-jre openjdk-11-jre-headless
  x11-common
Suggested packages:
  default-jre libasound2-plugins alsa-utils cups-common liblcms2-utils pciutils pcscd lm-sensors openjdk-11-demo openjdk-11-source visualvm libnss-mdns
  fonts-dejavu-extra fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei | fonts-wqy-zenhei fonts-indic
Recommended packages:
  alsa-ucm-conf alsa-topology-conf mesa-vulkan-drivers | vulkan-icd libxt-dev libatk-wrapper-java-jni fonts-dejavu-extra
The following NEW packages will be installed:
  ca-certificates-java fontconfig-config fonts-dejavu-core java-common libasound2 libasound2-data libavahi-client3 libavahi-common-data libavahi-common3 libcups2
  libdrm-amdgpu1 libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libfontconfig1 libgif7 libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0
  libglx0 libgraphite2-3 libharfbuzz0b libjpeg62-turbo liblcms2-2 libllvm11 libnspr4 libnss3 libpciaccess0 libpcsclite1 libsensors-config libsensors5 libvulkan1
  libx11-6 libx11-data libx11-xcb1 libxau6 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcb1 libxdamage1
  libxdmcp6 libxext6 libxfixes3 libxi6 libxrender1 libxshmfence1 libxtst6 libxxf86vm1 libz3-4 openjdk-11-jdk openjdk-11-jdk-headless openjdk-11-jre
  openjdk-11-jre-headless x11-common
0 upgraded, 63 newly installed, 0 to remove and 13 not upgraded.
Need to get 305 MB of archives.
After this operation, 573 MB of additional disk space will be used.
Do you want to continue? [Y/n]

This way we can have Java on the system without any major problems. To check that Java is working, you can check the installed version

java --version

Output:

openjdk 11.0.13 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.13+8-post-Debian-1deb11u1, mixed mode, sharing)

This way, we will be able to continue.

Installing Apache Cassandra on Debian 11

Fortunately, Apache Cassandra has a dedicated Debian repository with which we can have the latest stable version of the same and integrated into the system.

Before adding it, it is necessary to install some packages.

sudo apt install apt-transport-https gnupg2

Then add the GPG key of it.

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

Then, you can add the repository as follows:

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

Output:

deb https://downloads.apache.org/cassandra/debian 40x main

After this, you can install Apache Cassandra by running

sudo apt update
sudo apt install cassandra
1.- Install Apache Cassandra on Debian 11
1.- Install Apache Cassandra on Debian 11

Verifying the installation of Apache Cassandra

When Apache Cassandra is installed on the system, it can be managed as a system service using the systemctl command.

Therefore, to start it, just run the following command

sudo systemctl start cassandra

And to enable it to start with the system:

sudo systemctl enable cassandra

Output:

cassandra.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable cassandra

Now you can check the status of the service.

sudo systemctl status cassandra
2.- Cassandra status
2.- Cassandra status

You should also check the status of your Cassandra node.

sudo nodetool status
3.- Node status
3.- Node status

Finally, you can enter the Apache Cassandra shell.

cqlsh
4.- Apache Cassandra shell
4.- Apache Cassandra shell

As you can see, everything is working correctly.

Conclusion

Apache Cassandra is a wonderful application that allows us to have a complete and professional NoSQL database manager. I hope you liked this post.

So, you already know how to install Apache Cassandra on Debian 11.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook