How To Install Apache Cassandra on Ubuntu 24.04 LTS
In this tutorial, we will show you how to install Apache Cassandra on Ubuntu 24.04 LTS. Apache Cassandra is a powerful, open-source NoSQL database management system designed for handling large amounts of structured data across multiple commodity servers. Known for its scalability, high availability, and fault tolerance, Cassandra has become an essential tool for many organizations dealing with big data and real-time web applications.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Apache Cassandra on Ubuntu 24.04 (Noble Numbat). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.
Prerequisites
- A server running one of the following operating systems: Ubuntu and any other Debian-based distribution like Linux Mint.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- At least 8GB of RAM (16GB or more recommended for production environments).
- A minimum of 2 CPU cores.
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies.
- An Ubuntu 24.04 system with root access or a user with sudo privileges.
Install Apache Cassandra on Ubuntu 24.04 LTS
Step 1. Updating the Package Repository.
Before installing any new software, it’s always a good practice to update your system. Open a terminal and run the following commands:
sudo apt update sudo apt upgrade
This will ensure that your system has the latest package information and all installed packages are up to date.
Step 2. Installing Java.
Apache Cassandra requires Java to run. Cassandra 4.x and later versions support both Java 8 and Java 11. For this guide, we’ll install OpenJDK 11, which is recommended for optimal performance and compatibility.
Install OpenJDK 11 by running the following command:
sudo apt install openjdk-11-jdk
After the installation is complete, verify the Java version:
java -version
You should see output similar to this:
openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.24.04) OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.24.04, mixed mode, sharing)
Step 3. Installing Apache Cassandra on Ubuntu 24.04.
To install the latest version of Cassandra, we need to add the official Apache Cassandra repository to our system. This ensures that we get the most up-to-date and stable version of the database.
First, install the required packages to add a new repository over HTTPS:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
Next, import the Apache Cassandra repository GPG key:
curl -fsSL https://www.apache.org/dist/cassandra/KEYS | sudo gpg --dearmor -o /usr/share/keyrings/cassandra-archive-keyring.gpg
Now, add the Apache Cassandra repository to your system:
echo "deb [signed-by=/usr/share/keyrings/cassandra-archive-keyring.gpg] https://debian.cassandra.apache.org 41x main" | sudo tee /etc/apt/sources.list.d/cassandra.list
This command adds the repository for Cassandra 4.1.x. If you need a different version, replace “41x” with the appropriate version number.
With the repository added, update the package list and install Cassandra:
sudo apt update sudo apt install cassandra
The installation process will automatically start the Cassandra service. You can verify the status of Cassandra by running:
sudo systemctl status cassandra
If Cassandra is running correctly, you should see an output indicating that the service is active and running.
Step 4. Configure Cassandra.
After installation, Cassandra is configured to run on localhost by default. For a production environment or multi-node cluster, you’ll need to modify the configuration. The main configuration file is located at /etc/cassandra/cassandra.yaml
.
Here are some important settings you may want to adjust:
-
- cluster_name: Set a unique name for your cluster
- seeds: List the IP addresses of your seed nodes
- listen_address: Set to the IP address of the current node
- rpc_address: Set to 0.0.0.0 to allow remote connections
To edit the configuration file, use a text editor with sudo privileges:
sudo nano /etc/cassandra/cassandra.yaml
After making changes, save the file and restart Cassandra:
sudo systemctl restart cassandra
To ensure that Cassandra is working correctly, you can use the nodetool utility:
nodetool status
This command should display information about your Cassandra node, including its status (UN for Up/Normal) and load.
You can also connect to the Cassandra Query Language Shell (cqlsh
) to interact with the database:
cqlsh
If everything is set up correctly, you should see the cqlsh
prompt, where you can start executing CQL commands.
Congratulations! You have successfully installed Apache Cassandra. Thanks for using this tutorial for installing the Apache Cassandra on the Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official Apache website.