Cassandra Print

  • 0

How to Manually Install Apache Cassandra 5.x on Ubuntu 24.04

This guide explains how to manually install and configure Apache Cassandra 5.x on an Ubuntu 24.04 server.

The steps below are the manual equivalent of the Apache Cassandra Ansible automation playbook. They are written for beginners and can be followed command-by-command from an Ubuntu 24.04 terminal.


Requirements

Before starting, make sure you have:

  • Ubuntu 24.04 server
  • Root access or a user with sudo privileges
  • At least 4GB RAM recommended
  • Internet connection

Step 1 - Update Ubuntu Packages

First, update the Ubuntu package list and install available updates.


sudo apt update
sudo apt upgrade -y

Step 2 - Install Required Packages

Install the packages required by Cassandra.


sudo apt install -y curl gnupg apt-transport-https software-properties-common

Step 3 - Install Java 17

Apache Cassandra 5.x requires Java 17.


sudo apt install -y openjdk-17-jdk

Verify Java installation:


java -version

Expected output should show Java 17.


Step 4 - Add Apache Cassandra Repository Key

Create the keyring directory:


sudo mkdir -p /etc/apt/keyrings

Download the Apache Cassandra repository signing key:


curl -fsSL https://downloads.apache.org/cassandra/KEYS | \
sudo gpg --dearmor -o /etc/apt/keyrings/cassandra.gpg

Step 5 - Add Cassandra Repository

Add the Apache Cassandra 5.x package repository.


echo "deb [signed-by=/etc/apt/keyrings/cassandra.gpg] https://debian.cassandra.apache.org 50x main" | \
sudo tee /etc/apt/sources.list.d/cassandra.sources.list

Update package information:


sudo apt update

Step 6 - Install Apache Cassandra

Install Cassandra:


sudo apt install -y cassandra

Step 7 - Enable Cassandra Service

Enable Cassandra so it starts automatically after reboot.


sudo systemctl enable cassandra

Start Cassandra:


sudo systemctl start cassandra

Step 8 - Check Cassandra Service Status

Confirm Cassandra is running:


sudo systemctl status cassandra

You should see:


Active: active (running)

Step 9 - Verify Cassandra Cluster

Use nodetool to check the Cassandra node status.


sudo nodetool status

A healthy node should show:


UN

Meaning:

  • U = Up
  • N = Normal

Step 10 - Test Cassandra Database Connection

Connect to Cassandra using cqlsh:


cqlsh

Check the cluster name:


SELECT cluster_name FROM system.local;

Exit cqlsh:


exit;

Step 11 - Configure Firewall

If UFW firewall is enabled, allow Cassandra ports.

Cassandra Client Connections


sudo ufw allow 9042/tcp

Cassandra Internode Communication


sudo ufw allow 7000/tcp

Cassandra SSL Communication


sudo ufw allow 7001/tcp

Enable firewall:


sudo ufw enable

Check firewall status:


sudo ufw status

Common Cassandra Commands

Restart Cassandra


sudo systemctl restart cassandra

Stop Cassandra


sudo systemctl stop cassandra

View Cassandra Logs


sudo tail -f /var/log/cassandra/system.log

Installation Complete

Apache Cassandra 5.x is now installed and running on Ubuntu 24.04.

Your Cassandra server can now be used as a distributed NoSQL database cluster.


Was dit antwoord nuttig?
Back