Ubuntu

Installing Apache Cassandra on Ubuntu 20.04

Cassandra is used by thousands of firms worldwide to save and retrieve thousands of terabytes of data in an environment that is both painstakingly detailed yet easily accessible. Its reliability, along with its high fault tolerance, has earned the reputation it holds today. The DB Engine Ranking puts Cassandra at the top of their wide column store ranking.

In this tutorial, you’ll learn how to set up Apache Cassandra, one of the best NoSQL databases systems that is both free and open-source, which offers high linear scalability, along with low latency operability. It was originally conceived to support the inbox search feature on Facebook and has since improved until it was hailed as the most time-efficient and scalable distribution database.

Step 1: Install Oracle JAVA

First, we need to set up JAVA on your system since Cassandra requires Oracle JAVA to operate on any OS. This step is just a simple setup guide, so readers with already installed Java may skip step 1.

To illustrate how to set up Java on desktop, we will be downloading the latest version of its open-source platform: OpenJDK 14. This open-source version works with Cassandra just as well as any paid version, so it should suffice.

Type in the following command to update the repository:

$ sudo apt update


Then, run the command below to install OpenJDK 14:

$ sudo apt install openjdk-14-jdk


OpenJDK 14 should launch automatically upon install. To verify the install, type:

$ java -version

This should be displayed in the following output:


With Java installed, you can download the latest version of Apache Cassandra from its official website. However, in this demonstration, we’ll use the official Apache repository by adding it to the local software repository.

Step 2: Installing Apache Cassandra

The following steps show the details on how to download Apache Cassandra by adding its official repository. This particular method might prove useful in cases where you’re unable to download it from the official website.

Type in the commands below to fetch the repository’s GPG key:

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


Then, use the command below to add the repository:

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

Step 3: Install Apache Cassandra

Type in the commands to begin installation:

$ sudo apt update

$ sudo apt install cassandra


This should install Cassandra on your Ubuntu desktop. Then, verify the installation by typing in the following commands in the terminal:

$ nodetool status


If the output says Normal/Leaving/Joining/Moving, we’re all good.

Cqlsh is a CLI interface with which you can interact with the Cassandra Query Language.

Wrapping up

I hope the instructions listed above helped you set up Apache Cassandra on your Ubuntu desktop. Apache Cassandra needs Oracle Java to function and the open-source implementation of Java, the OpenJDK works just fine with Cassandra. The method used in this tutorial first added the Apache repository to the Ubuntu software repo, then installed the database.

What makes Cassandra, in particular, a stand out compared to other database systems is the high-volume data capacity that it offers, as well as its extremely low latency operations. The fact that so many large conglomerates use this database system, including Apple, Facebook, Instagram, Spotify, Twitter, eBay, and Netflix, speaks to its utility as a reliable data management platform.

About the author

Younis Said

I am a freelancing software project developer, a software engineering graduate and a content writer. I love working with Linux and open-source software.