How to Install Apache Cassandra via Tarball

Learn how to install Apache Cassandra via tarball with our step-by-step guide. Install Cassandra on your server quickly and easily.

How to Install Apache Cassandra via Tarball


In this blog post, we'll walk through installing Apache Cassandra on the Linux distribution of your choice via a tarball.

A tarball in Linux is a file that bundles multiple files and directories into a single package for easy distribution or backup.  Tarballs are typically used in Linux and Unix systems to distribute software or make backups.


Operating System

  • We'll need a Linux-based operating system to install Apache Cassandra.  The most popular Linux distributions are Ubuntu, Debian, Redhat Enterprise Linux (RHEL), or RHEL-compatible distros such as AlmaLinux or Rocky Linux.
  • Root access or a user account with sudo privileges (In this example, we use a user account with sudo privileges).

Install OpenJDK Java

The version of Java you need depends on the version of Cassandra you plan to install.  For Cassandra 3.11, you'll need Java 8, while for Apache Cassandra versions greater than 4.0.3, you can use Java 11.

Note: For Java 8, I strongly recommend a version greater than 1.8.0_151.

To check your system's existing Java version, open a terminal and run the following command:

java --version

If your Java version does not meet the requirements or if Java isn't installed, you'll need to install the appropriate version of OpenJDK.

The commands to install OpenJDK are as follows:

For an RHEL or RHEL-Compatible Linux Distribution:

  • sudo yum install java-11-openjdk java-11-openjdk-devel -y

For A Debian / Ubuntu Linux Distribution:

apt install openjdk-8-jdk

note:  Replace '8' with '11' if you need Java 11 for your installation.

Install Python 2.7 or Higher (for nodetool)

Cassandra's nodetool utility requires Python 2.7 or higher.  To check your system's current Python version, run the following command:

  • python --version

If the command above returns python not foundRun the following in the order below:

  • python2 --version
  • python3 --version

If the version displayed is lower than 2.7 or Python isn't installed, you'll need to install a compatible version.

Install the Cassandra Binary

Go to the official Apache Cassandra website and Select the Version

The first step to downloading the Apache Cassandra tarball is to go to the official Apache Cassandra website.  You can do this by opening your web browser and typing in the URL (or clicking the link).  This will take you to a landing page that will take you to the latest version of the major releases - 4.1.1, 4.0.9, 3.11.14, and 3.0.28.

Clicking on the version of your choice, a new window/tab will open with a link to the latest version of Apache Cassandra as well as instructions to verify the downloaded file.

Download the tarball file

There are two ways to copy the file to the server.  You can click the link on the install page to download the tarball to your computer and then upload the file via scp (or your file transfer program of choice) or ssh into the server and use wget or curl to download the tarball to the server.  We'll download and install the Apache Cassandra v4.1.1 tarball in the following steps.

Using Curl
curl -LJO

Here's a breakdown of the options used in the command:
  • -L: Follow any redirections if the server sends a redirect response.
  • -J: This option is used to save the file with the same name as it has on the remote server.
  • -O: This option tells Curl to save the file with the same name as the remote file.

Using wget


After using either command, you should see the Cassandra binary in the directory:  apache-cassandra-4.1.1-bin.tar.gz

Extracting and Installing Cassandra

Move the tarball file to the Directory of Your Choice

The most popular location for installing Apache Cassandra is the /opt directory, which is the directory we will use.

sudo mv /path/to/apache-cassandra-4.1.1-bin.tar.gz /opt

Replace "/path/to/cassandra.tar.gz" with the actual path and filename of the Cassandra tarball file if the directory you chose is different.

Extract the tarball file using the 'tar' command

Next, extract the Cassandra tarball file using the 'tar' command:

sudo tar -xvzf apache-cassandra-4.1.1-bin.tar.gz

You will see a directory named apache-cassandra-4.1.1

Rename the extracted folder to 'apache-cassandra' (optional)

After extracting the tarball file, you will see a new folder with a name similar to "apache-cassandra-x.x.x." To make it easier to work with, you can rename this folder to "apache-cassandra" using the following command:

sudo mv apache-cassandra-4.1.1 apache-cassandra

Replace "x.x.x" with the actual version number of Cassandra.

Create a Dedicated Cassandra User (optional)

Although optional, creating a dedicated user for running Cassandra is a good practice.  This user should have the proper user and group permissions.  To create a new user, follow the instructions below for your Linux distro (we are using 'cassandra' as our dedicated Cassandra user):

RHEL / RHEL Compatible

useradd -d /opt/apache-cassandra -g cassandra -M -r cassandra

Ubuntu / Debian

addgroup --system cassandra

adduser --quiet --system --ingroup cassandra --quiet --disabled-login --disabled-password --home /var/lib/cassandra --no-create-home -gecos "Cassandra database" cassandra

Change ownership of the Install Folder to the Cassandra User

We want to make sure the cassandra user has the appropriate permissions for the install location:

sudo chown -R cassandra:cassandra /opt/apache-cassandra

Change ownership of the folder to the dedicated user

If you have a dedicated user for running Cassandra, you can change the ownership of the Cassandra folder to that user using the following command:

sudo chown -R cassandrauser:cassandrauser /opt/apache-cassandra

Verify Installation and Configuration

Now that you have successfully installed Apache Cassandra on your Linux machine via tarball, verifying that the installation and configuration were successful is essential.  To do this, you can run the following command, which will display the version of Apache Cassandra:

/opt/apache-cassandra/bin/cassandra -v

If the command returns the version of Cassandra that you installed, you can be confident that the installation was successful.