Apache Cassandra 5 installation on Ubuntu

In this post we will have step-by-step process of installation of the Latestt version of Apache Cassandra 5.0.3 (as of Feb 2025 available as latest) on Ubuntu 20.

What problem I'm solving with this?

There is no direct documentation on the Cassandra to help on installation of latest version that is 5.0.3 on Ubuntu. So I've experimented it on the online Ubuntu terminal(kllercoda) and posting all the steps here.

Pre-requisite to install Cassandra

1. Ubuntu Terminal either killercoda or codespace on github works good for this experiment.
2. Cassandra has specific compatibility requirements with different Java versions, which are crucial for ensuring optimal performance and stability.
you must have super(root) user access to install cassandra.

Step 1: Install Java/JRE

Ensure Java installed by checking with command `java -version` and if not existing then install as following:


#install jdk17-jre 
apt install openjdk-17-jre-headless

java -version

Step 2: Add Cassandra Repository

Since Cassandra is not included in the default Ubuntu repositories, you must add its repository with the following commands.
sudo apt install apt-transport-https
Let's get the cassandra to be downloaded with secure way to dao this we need to have GPG key from Cassandra:
wget -qO- https://downloads.apache.org/cassandra/KEYS | sudo apt-key add -
Note: don't miss the dash at the end of the line in the above wget command. Actual package information will be added to repo withfollowing line, this option can vary for cassandra versions 40x, 41x or 50x which can placed before the main.
echo "deb https://debian.cassandra.apache.org 50x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
Update the package index
sudo apt update

Step 3: Install Cassandra 5.0.3

Now that the repository is set up, you can install Cassandra 5.0.3.
sudo apt install cassandra -y
Wait for the process to complete. Once the installation finishes, the Cassandra service starts automatically. Also, a user named cassandra is created during the process. That user is used to run the service.
systemctl status cassandra

Verify Cassandra installation

nodetool status

Don't work HARD!

Working hard it means you are not using your brain to work! Repeatative task can be automated that is called SMART work. Let's do that here:
apt install -y openjdk-17-jre-headless 
apt install apt-transport-https
wget -qO- https://downloads.apache.org/cassandra/KEYS | sudo apt-key add -

echo "deb https://debian.cassandra.apache.org 50x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list

apt update
sudo apt install cassandra -y
sleep 10
echo "Cassandra installed verify"
nodetool status

Troubleshoot pointers:

Initializing cassandra server may takes some more seconds so wait if you see :
Exception in thread "main" java.lang.IllegalArgumentException: Server is not initialized yet, cannot run nodetool.
Obeserve in the output that Active line should have `active(running)`. If it is not that there is something is missing may be Java / JRE missmatched or unable to launch the Cassandra process we can look at the system logs.
Please write your experiance with Cassandra 5 installation in the comment box. Thanks for being with me till here.

Comments

Popular posts from this blog

Ansible Jinja2 Templates: A Complete Guide with Examples

Ansible 11 The uri module with examples

Jenkins Active choices parameter - Dynamic input