How to Install Apache Cassandra on Ubuntu 24.04
Learn how to install apache cassandra on ubuntu 24.04 with official Apache repositories, OpenJDK runtime, nodetool cluster checks, and cqlsh queries.

6 min read
Learn how to install apache cassandra on ubuntu 24.04 with official Apache repositories, OpenJDK runtime, nodetool cluster checks, and cqlsh queries.
- Prerequisites and Supported Releases
- Step 1: Installing the Java Runtime Prerequisite (OpenJDK)
- Step 2: Adding the Official Apache Cassandra APT Repository
When building global-scale internet services, Internet of Things (IoT) sensor pipelines, financial fraud detection systems, or high-velocity messaging platforms, traditional relational databases collapse under immense write volumes.
Apache Cassandra is a distributed, decentralized, highly scalable NoSQL wide-column database management system designed to handle massive volumes of data across multiple data centers with zero single point of failure.
Originally developed at Facebook and open-sourced under the Apache Software Foundation, Cassandra's masterless peer-to-peer ring architecture guarantees linear scalability and high availability.
Deploying Apache Cassandra on Ubuntu 24.04 LTS requires configuring a compatible Java runtime environment, integrating upstream Apache repositories, and tuning cluster parameters in cassandra.yaml.
In this guide, we walk through how to install apache cassandra on ubuntu 24.04, verify cluster health with nodetool, and execute Cassandra Query Language (CQL) operations.
Complete step-by-step enterprise database administrator guide to deploying Apache Cassandra 5.0 on Ubuntu 24.04 LTS (Noble Numbat). Explains OpenJDK Java runtime installation, configuring the official Apache Cassandra APT repository, editing cassandra.yaml cluster parameters, verifying cluster node topology with nodetool status, and creating keyspaces in the cqlsh interactive shell.
Prerequisites and Supported Releases
This guide is thoroughly verified on Ubuntu 24.04 LTS (Noble Numbat) & Ubuntu 22.04 LTS. The instructions apply cleanly to cloud instances (AWS EC2, Google Compute Engine, DigitalOcean, Hetzner), bare-metal servers, and local virtual machines.
Before proceeding, ensure you have the following requirements satisfied:
- A server or virtual machine running Ubuntu 24.04 LTS or Ubuntu 22.04 LTS.
- Minimum 4 GB RAM and 2 CPU cores (8 GB+ recommended for production).
- A non-root user account with
sudoadministrative privileges. - Python 3 installed (required for the
cqlshcommand-line utility).
Step 1: Installing the Java Runtime Prerequisite (OpenJDK)
Apache Cassandra is written in Java and requires a compatible Java Virtual Machine (JVM).
Cassandra 5.0 and 4.x run natively on OpenJDK 11 or OpenJDK 17 LTS.
Install the OpenJDK runtime package using apt:
Verify that the Java binary is available on your system path:
# Update package index and install OpenJDK 17:
sudo apt update
sudo apt install -y openjdk-17-jre-headless
# Verify Java version:
java -version
# Expected output confirms:
# openjdk version "17.0.x" ...
# OpenJDK 64-Bit Server VM ...
Step 2: Adding the Official Apache Cassandra APT Repository
To install the latest verified stable release of Apache Cassandra, configure the official Apache Software Foundation APT repository.
First, install prerequisite network and encryption utilities:
Import the official Apache Cassandra GPG signing key into /etc/apt/keyrings/:
Add the repository definition specifying the Cassandra 5.0 release series (50x):
# Install repository transport tools:
sudo apt install -y curl gnupg apt-transport-https
# Ensure secure keyrings directory exists:
sudo mkdir -p /etc/apt/keyrings
# Download and dearmor Apache Cassandra GPG key:
curl -fsSL https://downloads.apache.org/cassandra/KEYS | \
sudo gpg --dearmor -o /etc/apt/keyrings/cassandra-archive-keyring.gpg
# Add Cassandra 5.0 repository definition:
echo "deb [signed-by=/etc/apt/keyrings/cassandra-archive-keyring.gpg] https://debian.cassandra.apache.org 50x main" | \
sudo tee /etc/apt/sources.list.d/cassandra.list
# Refresh APT repository cache:
sudo apt update
Step 3: Installing Apache Cassandra on Ubuntu 24.04
With the official repository configured, install the cassandra package using apt.
The package manager installs all database daemons, systemd service definitions, and the nodetool administration utility:
Start and enable the Cassandra service:
# Install Cassandra:
sudo apt install -y cassandra
# Enable service to launch automatically on boot:
sudo systemctl enable cassandra
# Verify service health:
sudo systemctl status cassandra
# Expected output confirms: Active: active (running)
Step 4: Verifying Cluster Status with nodetool
The primary diagnostic utility for managing Apache Cassandra nodes is nodetool.
Because Cassandra initializes its distributed ring topology asynchronously, wait 30–60 seconds after starting the daemon before checking cluster health.
Execute nodetool status to inspect the active node state:
Confirm that your node displays the status UN (Up and Normal):
# Check cluster node status:
sudo nodetool status
# Output confirms single-node ring:
# Datacenter: datacenter1
# =======================
# Status=Up/Down
# |/ State=Normal/Leaving/Joining/Moving
# -- Address Load Tokens Owns (effective) Host ID Rack
# UN 127.0.0.1 105.2 KiB 16 100.0% a1b2c3d4-e5f6-7890-abcd-1234567890ab rack1
Understanding Nodetool Status Flags
The two leading characters in the status table indicate the health of the node:
U indicates that the node is Up and online.
N indicates that the node is in the Normal operating state participating in the token ring.
Step 5: Connecting to the Database via cqlsh
Cassandra Query Language (CQL) provides a familiar SQL-like syntax for creating schemas, tables, and querying wide-column data.
Launch the interactive CQL shell utility (cqlsh):
Create a keyspace (the Cassandra equivalent of a database schema) and test table creation:
-- Launch cqlsh from terminal:
-- cqlsh
-- Inside cqlsh shell:
-- Connected to Test Cluster at 127.0.0.1:9042
-- [cqlsh 6.2.0 | Cassandra 5.0.0 | CQL spec 3.4.7]
-- Create a keyspace with SimpleStrategy replication:
CREATE KEYSPACE ecommerce_data WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
-- Use the keyspace:
USE ecommerce_data;
-- Create a sample time-series orders table:
CREATE TABLE customer_orders (
customer_id uuid,
order_id timeuuid,
product_name text,
amount decimal,
PRIMARY KEY (customer_id, order_id)
);
-- Describe the keyspace:
DESCRIBE KEYSPACE ecommerce_data;
-- Exit shell:
QUIT;
Step 6: Configuring Firewall Rules for Multi-Node Clusters
In single-node development, Cassandra binds strictly to localhost (127.0.0.1).
In multi-node production clusters, configure UFW to allow inter-node gossip (port 7000) and client CQL connections (port 9042) strictly from authorized cluster IP addresses:
Review this port reference table for Cassandra services:
| Port Number | Protocol | Default Purpose | Exposure Recommendation |
|---|---|---|---|
7000 | TCP | Intra-node cluster communication (Gossip) | Strictly internal cluster VPC nodes only |
7001 | TCP | TLS encrypted intra-node communication | Strictly internal cluster VPC nodes only |
9042 | TCP | CQL native transport client port | Application servers only (protected by UFW) |
7199 | TCP | JMX monitoring port | Localhost only (or authenticated monitoring agents) |
Troubleshooting and Common Errors
When configuring Ubuntu servers, unexpected permission errors, network timeouts, or lock contention can occur. Review these common issues and verified resolutions:
Connection error: ('Unable to connect to any servers', {'127.0.0.1:9042': ...})
Cause: Cassandra daemon is still in the middle of JVM initialization or failed due to low RAM.
Resolution: Wait 60 seconds and check /var/log/cassandra/system.log to confirm initialization completed.
sudo tail -n 50 /var/log/cassandra/system.log
Cassandra fails to start: Insufficient memory (OOM)
Cause: JVM heap exceeded available physical RAM on the system.
Resolution: Edit /etc/cassandra/jvm11-server.options or /etc/cassandra/jvm17-server.options and reduce max heap size (e.g. -Xmx2G -Xms2G).
free -m
cqlsh: command not found
Cause: Python 3 is missing or python3-cqlsh was not symlinked.
Resolution: Install python3: sudo apt install -y python3 python3-pip.
which python3
Security Best Practices and Hardening
Never expose Cassandra ports (7000, 7199, 9042) to the public internet; always isolate nodes inside private VPC subnets with strict UFW rules.
Enable internal authentication in /etc/cassandra/cassandra.yaml by changing authenticator: AllowAllAuthenticator to PasswordAuthenticator.
Change the default superuser credentials (cassandra / cassandra) immediately after enabling password authentication.
Related Ubuntu Tutorials and Documentation
Deepen your Linux system administration skills with our related production-tested guides:
- How to Install Java on Ubuntu 24.04 — Configure OpenJDK versions and
JAVA_HOMEenvironment settings for Cassandra. - How to Set Up a Firewall with UFW on Ubuntu 24.04 — Secure Cassandra inter-node gossip and CQL client connection ports.
- Initial Server Setup on Ubuntu 24.04 LTS — Base operating system tuning and systemd administration.
Authoritative References and Official Documentation

The Linux Command Line, 2nd Edition: A Complete Introduction
Frequently Asked Questions
Quick answers to common questions and configurations
/var/lib/cassandra/data/, commit logs in /var/lib/cassandra/commitlog/, and operational logs in /var/log/cassandra/.Editorial Disclosure: Website Vidya is supported by our readers. When you purchase hosting, tools, or software through our verified partner links, we may earn an affiliate commission at no extra cost to you. We only recommend solutions we trust and rigorously verify.
Rajesh Ray
I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.
Most Read Guides
TrendingUbuntu Server Not Booting? 10 Simple Steps to Fix It Fast
How to Create a 3D Button in HTML and CSS: Easy Steps
How to Install Python and Pip on Ubuntu 24.04 LTS
How to Install Nginx on Ubuntu 24.04
How to Install Python on Ubuntu 24.04 LTS
Related Technical Guides
Tested runbooks, server administration walkthroughs, and troubleshooting guides


Join the Conversation & Perspective
Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.
No comments on this guide yet. Be the first to share your thoughts or ask a question!