Support Online
Skip to main content

Apache Cassandra Installation Ubuntu 22.04

In this guide, you will learn step by step how to install Apache Cassandra on Ubuntu 22.04 and create a single-node Cassandra cluster.

Apache Cassandra; It is a powerful NoSQL database that is frequently used in big data applications thanks to its high scalability, masterless architecture and high fault tolerance.

This setup specifically:

  • development environments
  • test systems
  • Users who want to learn Cassandra

Ideal for.

What You Will Learn in This Guide

Once this guide is completed you will be able to:

  • Installing Apache Cassandra on Ubuntu 22.04
  • Add Cassandra official repository
  • Verify that the service is running
  • Checking cluster status with nodetool
  • Connecting to Cassandra shell with cqlsh

Technical Summary

The following steps will be followed to install Cassandra:

  1. Adding Cassandra official repository
  2. Introducing warehouse keys to the system
  3. Installing the Cassandra package
  4. Checking that the service is running
  5. Verifying cluster status with nodetool
  6. Connecting to the database with cqlsh

Purpose: To create a single node Cassandra cluster running on Ubuntu 22.04.


Prerequisites

The following requirements must be met before starting the installation.

  • Ubuntu 22.04 server
  • Minimum 2 GB RAM
  • user with sudo privilege
  • Internet connection
  • OpenJDK 8 or OpenJDK 11

Java Installation

Cassandra is a Java-based database. Therefore, Java must be present in the system.

sudo apt install openjdk-11-jdk

This command installs the OpenJDK 11 JDK package.

To verify the installation:

java -version

Updating Package Lists

Update system packages.

sudo apt update

To upgrade the system to the latest version:

sudo apt upgrade

Adding Cassandra Official Repository

The official repository must be added to install Cassandra packages.

echo "deb http://www.apache.org/dist/cassandra/debian 40x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list

This command adds the Cassandra 4.x repository to the system.

Adding Cassandra Repository Key

Key is added to ensure warehouse security.

wget -q -O - https://www.apache.org/dist/cassandra/KEYS | sudo tee /etc/apt/trusted.gpg.d/cassandra.asc

Re-Updating Package List

The package list is updated again for new repository definitions.

sudo apt update

Apache Cassandra Installation

You can now install the Cassandra package.

sudo apt install cassandra

Once the installation is complete, the service will start automatically.

Checking Cassandra Service

To verify that the service is running:

sudo systemctl status cassandra

You should see a line similar to the following in the output:

active (running)

Possible error

If you see the OOM-Kill error, the system RAM is insufficient. Minimum 2 GB RAM is recommended.

Checking Cassandra Cluster Status

Nodetool can be used to see Cassandra cluster status.

sudo nodetool status

Sample output:

UN 127.0.0.1

The meaning here is:

U → Up (çalışıyor)
N → Normal (sorunsuz çalışıyor)

Connecting to Cassandra Shell Interface

To start Cassandra Query Language Shell:

cqlsh

On successful connection, the following message appears:

Connected to Test Cluster at 127.0.0.1:9042

To exit the shell:

exit

Cassandra Default Ports

Cassandra uses the following ports.

Port Açıklama
9042 CQL client bağlantısı
7000 Node iletişimi
7199 JMX monitoring

Frequently Asked Questions

Why does Cassandra require at least 2 GB RAM?

Cassandra is Java-based and high heap memory usage causes low RAM performance problems.

What does UN status mean?

nodetool in status output:

U → Up (node çalışıyor)
N → Normal (veri taşıma işlemi yok)

Is this setup suitable for production?

No. This guide sets up a single-node Cassandra cluster. Multi-node clusters are recommended in production environments.

Which port does Cassandra use?

Cassandra uses port 9042 by default for client connections.

Which is the most stable Java version for Cassandra?

Generally OpenJDK 11 is the most stable and recommended version.

Result

In this guide, you installed Apache Cassandra on Ubuntu 22.04 and created a single-node Cassandra cluster.

Now:

You can connect to the Cassandra database with cqlsh, develop your NoSQL projects, and test the Cassandra data model.

For higher performance and scalable projects, it is recommended to install Cassandra as çok düğümlü cluster.