Apache Cassandra is a free and open-source distributed NoSQL Database Management System designed to handle large amounts of data across many nodes, providing high availability, high performance, and linea scalability.

As a result, if you need high availability (zero downtime) and scalability database, Apache Cassandra is the right choice for you. Linear scalability and proven fault-tolerance on cloud infrastructure or commodity hardware make it the perfect choice for mission critical data.

Cassandra is used by large companies such as Apple, Github, Microsoft, Spotify, Uber, Walmart, Instagram, Netflix and many more.

In this guide, we will be installing Apache Cassandra Database on Ubuntu 20.04. By the time of writing this tutorial, Apache Cassandra 3.11.7 is the current stable release.

Let’s start by adding the Apache repository of Cassandra to /etc/apt/sources.list.d/cassandra.sources.list:

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

Good, now we need to add the repository keys:

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

If the above command raised an error indicating that curl does not exist, you have to install it using the below command:

$ sudo apt install curl

Refreshing our repositories:

$ sudo apt update

Note: If the above command throwed a GPG error, then you have to add the public key manually:

$ sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-key A278B781FE4B2BDA

The actual public key may be different, you will get it from the error message itself and run the command again. For a list of Apache contributor public keys, you can check them here.

And then refresh repositories again:

$ sudo apt update

Finally, let’s install Cassandra:

$ sudo apt install cassandra -y

Awesome, the -y flag will confirm that we’re agreeing for all required dependencies for Cassandra (including Java, and many more packages), this will take few seconds/minutes depending on your hardware.

Let’s check if we have successfully installed:

$ nodetool status

Output:

[sudo] password for rockikz: 
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens       Owns (effective)  Host ID                               Rack
UN  127.0.0.1  236.49 KiB  256          100.0%            837c4330-8870-436b-82bd-d039ea710d0a  rack1

Awesome, Cassandra is installed and running. You can start Cassandra with sudo service cassandra start and stop it with sudo service cassandra stop. But this is unnecessary now as the service will be started automatically when it’s installed.

Conclusion

Awesome, in this guide, you have successfully managed to install Apache Cassandra on your Ubuntu machine. Please check the official documentation to get started.

Happy Installing ♥

1 thought on “How to Install Apache Cassandra on Ubuntu 20.04

Comments are closed.