How to Install Apache Cassandra on Ubuntu 18.04

Spread the love

In this article, we will show you how to install Apache Cassandra on Ubuntu 18.04.

Apache Cassandra is an open-source NoSQL database manager which offers high availability and scalability by providing fault-tolerant multi-level cloud setup. It is useful for applications that will require a lot of data with redundancy but without compromising performance and security. There are several advantages that we’ll go over down below. Let’s begin with the installation.

The main advantages of the Apache Cassandra database software against competing options are the following:

  • Distributed Nodes
  • Replication Support
  • Scalable
  • Fault-Tolerant
  • Data Consistency and Redundancy
  • In-house Query Language (Cassandra Query Language)

Apache Cassandra is developed by Apache Software Foundation using Java.

It is licensed under Apache License 2.0. As of writing, the latest stable version of Apache Cassandra is 3.11.

Hardware Requirements

For this tutorial, we will be using an Ubuntu VPS. Before continuing, make sure that your server meets the following minimum or recommended hardware configuration.

The basic rule for every application requirement is the more, the better, especially for busy databases. Apache Cassandra database software is CPU and RAM resource-intensive, and will perform better on CPUs with more cores, and servers with a greater capacity of RAM. It also requires RAM with ECC capability to avoid any memory-related code corruption. The minimum hardware requirement for a production server installation is 2 CPU cores and 8GB of RAM with ECC. The recommended amount of resources would be 8 CPU cores and 32GB of RAM or more with ECC.

For disk setup, it is recommended to use a RAID 0 configuration to make use of the additional throughput that the setup can provide.

Step 1: Checking for Updates and Dependencies

To start with the installation, log in first to your server via SSH using your favorite terminal:

ssh [username]@[server_ip_address] -p [Port_Number]

Modify the [username]variable with the account name of a root-privileged user found on the server (or the root user itself), and replace the [server_ip_address] and [Port_Number] variables with the public facing IP address and SSH port number of your server.

Before starting with the installation, it is best to update and upgrade all installed Ubuntu packages with their latest versions:

apt-get update
apt-get upgrade

It is also best to install Linux common libraries and dependencies to ensure we will not encounter any missing library or dependency issues during and for future installations.

apt-get install software-properties-common build-essential -y

Step 2: Installing OpenJDK

To begin, we will need to install Java on our server since Apache Cassandra makes use of the Java VM. Currently, Apache Cassandra is not stable on the latest version of Java which is Java 11. For this, we will install Java 8 which is a reliable and stable version of Java.

Fortunately, OpenJDK version 8 is included by default in Ubuntu’s repository. To proceed, type the following command:

apt-get install openjdk-8-jdk -y

Once the Java 8 package and requirements have been installed, verify our current active Java version:

java -version

The prompt should then output the following text:
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.18.04.1-b03)

OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)

Step 3: Installing Apache Cassandra

Apache Cassandra repository is not available in Ubuntu by default. For this, we will need to download and activate its repository.

First, we will need to add the GPG keys using the following command:

wget -q -O - | sudo apt-key add -

Second, use the following command to add and enable the Apache Cassandra repository. Please note that at the time of writing, the latest version of Apache Cassandra is v3.11.

sh -c 'echo "deb 311x main" > /etc/apt/sources.list.d/cassandra.list'

To get the latest package from the repository, supply the Ubuntu update command:

apt-get update

Finally, install Apache Cassandra and additional packages and libraries it requires using this next line:

apt-get install cassandra -y

Verify the Apache Cassandra service is installed and running:

systemctl status cassandra

● cassandra.service - LSB: distributed storage system for structured data
Loaded: loaded (/etc/init.d/cassandra; generated)
Active: active (exited) since Sun 2019-05-19 18:36:31 CDT; 1min 50s ago
Docs: man:systemd-sysv-generator(8)

Make sure Apache Cassandra is enabled at boot/startup:

systemctl enable cassandra

Step 4: Configuring Apache Cassandra

The main configuration file for Apache Cassandra is located at


Here are the parameters that can be modified:

  • cluster_name: your preferred cluster name
  • seeds: set of IP address of nodes separated by a comma
  • storage_port: the data storage port, must be allowed in the firewall
  • listen_address: sets the port where Apache Cassandra should listen
  • native_transport_port: port for clients to connect with Cassandra, must also be allowed in the firewall

Step 5: Testing Apache Cassandra

Check if we can see the status using built-in nodetool from the Apache Cassandra package. Nodetool is used for managing Apache Cassandra clusters. You can learn more about nodetool here.

nodetool status

Almost the same output should be produced as Apache Cassandra settings is at default.

To check the connection to our default cluster (Test Cluster), we will utilize Apache Cassandra’s built-in command line shell called cqlsh. It is used to interact with Apache Cassandra using its own query language called CQL (Cassandra Query Language)

To get into the shell, type the following:


You should see almost the same output.

That’s ityou now have a working Apache Cassandra cluster powered by Ubuntu 18.04. To learn more about setting up Apache Cassandra, check their official online documentation here.

Of course, you don’t have to install Apache Cassandra on Ubuntu 18.04if you use or have one of our Managed Linux VPS Support services, in which case you can just ask our support team to install Apache Cassandra on your Ubuntu 18.04 server for you. They are available 24/7 and will be able to help you with the installation.

PS. If you enjoyed reading this blog post on how to install Apache Cassandra on Ubuntu 18.04, feel free to share it on social networks using the share shortcuts, or simply leave a comment in the comments section. Thanks.

Leave a Reply

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