January 27, 2022
How to install Apache Cassandra on Ubuntu 20.04 LTS

How To Install Apache Cassandra On Ubuntu 20.04 LTS

On this article we will discuss how to install Apache Cassandra 4.0 on Ubuntu 20.04 LTS Operating system.


Apache Cassandra is open-source high-performance NoSQL database management system designed to handle large amounts of data across many commodity servers, providing fault tolerance, linear scalability, and consistency across multiple nodes. Each Cassandra node in the cluster will have a similar job. Data is circulated over the bunch which implies every node holds various information. On this article, we will show you how to install Apache Cassandra on Linux Ubuntu 20.04 LTS operating system.

Cassandra has been used by many companies on handle their daily operation, such as : Netflix, Facebook, Cisco, Hulu, Twitter. Cassandra was developed at Facebook to power the Facebook inbox search feature, and then Facebook released Cassandra as an open-source project on Google code in July 2008.

Apache Cassandra Installation on Ubuntu 20.04 LTS

In discussing Apache Cassandra installation, this article will be divided into several subsections, namely:

  • Prerequisite
  • Add Apache Cassandra Repository
  • Install Apache Cassandra
  • Verify Cassandra Installation

1. Prerequisite

Before installing Apache Cassandra on Ubuntu 20.04 LTS, we have to prepare the environment first. The Apache Cassandra installation requires :

  • A user with sudo privileges
  • Sufficient space and the last update of Ubuntu 20.04 LTS repository.
  • Java, ensure our system has had Java installed. If it was not installed yet, we can either install Oracle Java or OpenJDK. For Java installation, already discussed in the previous article. We can check which java is installed on our system by typing java -version command line as shown below.
ramans@otodiginet:~$ java --version
 openjdk 11.0.10 2021-01-19
 OpenJDK Runtime Environment (build 11.0.10+9-Ubuntu-0ubuntu1.20.04)
 OpenJDK 64-Bit Server VM (build 11.0.10+9-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
java -version, for checking java was installed on the system or no.

Before the installation is started, we must update the system with the command line: sudo apt update.

ramans@otodiginet:~$ sudo apt update
 Hit:1 http://mirror.telkomuniversity.ac.id/ubuntu focal InRelease
 Hit:2 http://mirror.telkomuniversity.ac.id/ubuntu focal-updates InRelease
 Hit:3 http://mirror.telkomuniversity.ac.id/ubuntu focal-backports InRelease
 Hit:4 http://mirror.telkomuniversity.ac.id/ubuntu focal-security InRelease        
 Hit:5 http://ppa.launchpad.net/teejee2008/ppa/ubuntu focal InRelease              
 Get:6 https://dl.bintray.com/apache/cassandra 311x InRelease [3,903 B]
sudo apt update | update package system on Ubuntu.

Add Apache Cassandra Repository

The next step is to add Apache Cassandra repository to Ubuntu 20.04 package system. For this purpose we will download from Cassandra repository and applied it. The step is as follow.

ramans@otodiginet:~$ echo "deb http://downloads.apache.org/cassandra/debian 40x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
deb http://downloads.apache.org/cassandra/debian 40x main
ramans@otodiginet:~$ curl https://downloads.apache.org/cassandra/KEYS | sudo apt-key add -
   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                  Dload  Upload   Total   Spent    Left  Speed
 100  255k  100  255k    0     0   138k      0  0:00:01  0:00:01 --:--:--  138k

Until this point, we have added Apache Cassandra to the Ubuntu 20.04 LTS,.

3. Install Apache Cassandra

At this step, we will install Apache Cassandra. After adding Cassandra repository, then we re-update package list sistem by submitting command line : sudo apt udate again.

amans@otodiginet:~$ sudo apt-get update
 Hit:1 http://mirror.telkomuniversity.ac.id/ubuntu focal InRelease
 Hit:2 http://mirror.telkomuniversity.ac.id/ubuntu focal-updates InRelease
 Hit:3 http://mirror.telkomuniversity.ac.id/ubuntu focal-backports InRelease
 Hit:4 http://mirror.telkomuniversity.ac.id/ubuntu focal-security InRelease                
 Hit:6 http://ppa.launchpad.net/teejee2008/ppa/ubuntu focal InRelease                      
 Get:5 https://dl.bintray.com/apache/cassandra 40x InRelease [3,182 B]
 Get:7 https://dl.bintray.com/apache/cassandra 311x InRelease [3,903 B]
 Get:8 https://dl.bintray.com/apache/cassandra 40x/main i386 Packages [688 B]
 Get:9 https://dl.bintray.com/apache/cassandra 40x/main amd64 Packages [688 B]
 Fetched 8,461 B in 4s (2,075 B/s)
 Reading package lists… Done

After all are set, then we just install Apache Cassandra by hitting command line : sudo apt-get install cassandra.

ramans@otodiginet:~$ sudo apt-get install cassandra
 Reading package lists… Done
 Building dependency tree       
 Reading state information… Done
 The following packages were automatically installed and are no longer required:
   libfprint-2-tod1 libllvm9
 Use 'sudo apt autoremove' to remove them.
 Suggested packages:
 The following NEW packages will be installed:
install apache Cassandra

By default, Apache Cassandra service is already running after installation was done. At this tutorial we will verify Cassandra by checking the log files as follow : tail -f /var/log/cassandra/system.log.

Cassndar Log file

It seems, if the Cassandra has running properly.

4. Verifying Cassandra Status

After installation was completed done, then we have to check the Cassandra status. Was it running properly or not. For this purpose we will use the command line : nodetool status.

amans@otodiginet:~$ nodetool status
 Datacenter: datacenter1
 |/ State=Normal/Leaving/Joining/Moving
 --  Address    Load        Tokens  Owns (effective)  Host ID                               Rack 
 UN  213.36 KiB  16      ?                 26bd4613-8f91-42fc-a8c0-716465b4a34c  rack1
Nodetool Status | Apache Cassandra
Nodetool Status

alternatively, we can also connect to the Cassandra database with the command line: cqlsh.

amans@otodiginet:~$ cqlsh
 Connected to Test Cluster at
 [cqlsh 5.0.1 | Cassandra 4.0 | CQL spec 3.4.5 | Native protocol v4]
 Use HELP for help.
 cqlsh> HELP
 Documented shell commands:
 CQL help topics:
 AGGREGATES               CREATE_KEYSPACE           DROP_TRIGGER      TEXT     
 ALTER_TABLE              CREATE_TABLE              FUNCTIONS         TRUNCATE 
 ALTER_TYPE               CREATE_TRIGGER            GRANT             TYPES    
 ALTER_USER               CREATE_TYPE               INSERT            UPDATE   
 APPLY                    CREATE_USER               INSERT_JSON       USE      
 ASCII                    DATE                      INT               UUID     
 BATCH                    DELETE                    JSON            
 BEGIN                    DROP_AGGREGATE            KEYWORDS        
 BOOLEAN                  DROP_FUNCTION             LIST_ROLES      
 COUNTER                  DROP_INDEX                LIST_USERS      
 CREATE_FUNCTION          DROP_ROLE                 SELECT          
 CREATE_INDEX             DROP_TABLE                SELECT_JSON     
cqlsh to connect Cassandra DB
cqlsh to connect Cassandra DB


We have already installed Apache Cassandra on Ubuntu 20.04 LTS successfully. For configuring Apache Cassandra can be found on Apache Cassandra Configuration article. I hope this article could be helpful. Have a nice day and happy weekend.

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *