How To Install Apache Cassandra on Ubuntu 22.04 LTS
In this tutorial, we will show you how to install Apache Cassandra on Ubuntu 22.04 LTS. For those of you who didn’t know, Apache Cassandra is a free and open-source NoSQL database management system drawn to manipulate large amounts of information across many servers with no single point of failure. Its linear scalability and proven fault tolerance on commodity hardware or cloud infrastructure make it the perfect platform for mission-critical data.
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 NoSQL database on Ubuntu 22.04 (Jammy Jellyfish). 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 22.04, 20.04, 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).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Apache Cassandra on Ubuntu 22.04 LTS Jammy Jellyfish
Step 1. First, make sure that all your system packages are up-to-date by running the following apt
commands in the terminal.
sudo apt update sudo apt upgrade sudo apt install wget apt-transport-https gnupg2 software-properties-common
Step 2. Installing Java.
Cassandra is a cross-platform application written in Java. If Java is not installed in your system, Let’s go ahead and install it. The following command can install Java on your system:
sudo apt install openjdk-8-jre-headless
To verify that Java is now installed, run the following command:
java -version
Step 3. Installing Apache Cassandra on Ubuntu 22.04.
By default, Apache Cassandra is not available on Ubuntu 22.04 base repository. Now run the following command below to add the Cassandra repository to your Ubuntu system:
sudo sh -c 'echo "deb http://www.apache.org/dist/cassandra/debian 40x main" > /etc/apt/sources.list.d/cassandra.list'
Next, import the GPG key:
wget -q -O - https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
Once the repository is enabled, now install the latest version of Sublime Text using the below command:
sudo apt update sudo apt install cassandra
After successfully installation, enable Cassandra (to start automatically upon system boot), start, and verify the status using the commands below:
sudo systemctl enable cassandra sudo systemctl start cassandra sudo systemctl status cassandra
Step 4. Accessing the Apache Cassandra on the Ubuntu 22.04.
The cqlsh
is the command-line tool written in Python for executing the Cassandra Query Language (CQL) command. It’s the Cassandra client command-line utility. You can connect to the database by typing cqlsh
:
cqlsh
Output:
Connected to Test Cluster at 127.0.0.1:9042 [cqlsh 6.0.0 | Cassandra 4.0.1 | CQL spec 3.6.8 | Native protocol v5] Use HELP for help. cqlsh>
Congratulations! You have successfully installed Apache Cassandra. Thanks for using this tutorial for installing Apache Cassandra NoSQL database on Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the official Apache website.