DropVPS Team
Writer: John hens
how to install cassandra on redhat 9 linux

Table of Contents
What you will read?
Apache Cassandra is an open-source, distributed NoSQL database known for its scalability, performance, and fault tolerance. Installing Cassandra on Red Hat Enterprise Linux 9 allows you to build high-performance, data-driven applications that can handle massive workloads efficiently.
Step 1: Update the System
Before installing Cassandra, update your system to make sure all packages are up to date and compatible.
sudo dnf update -y
Step 2: Install Java
Apache Cassandra requires Java to run. The recommended version is OpenJDK 17, which you can install using the DNF package manager.
sudo dnf install java-17-openjdk -y
Verify the Java installation:
java -version
Step 3: Add Apache Cassandra Repository
To install the latest stable version of Cassandra, add its official repository to your Red Hat 9 system.
cat <<EOF | sudo tee /etc/yum.repos.d/cassandra.repo
[cassandra]
name=Apache Cassandra
baseurl=https://downloads.apache.org/cassandra/redhat/311x/
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://downloads.apache.org/cassandra/KEYS
EOF
Then update the package index:
sudo dnf update -y
Step 4: Install Apache Cassandra
Now install Apache Cassandra from the official repository to get the latest stable version for Red Hat 9.
sudo dnf install cassandra -y
Then start and enable the Cassandra service.
sudo systemctl enable cassandra
sudo systemctl start cassandra
Step 5: Verify Cassandra
It’s important to check that Cassandra is running correctly and responding to client requests to ensure your database is ready for use
sudo systemctl status cassandra
You can also test the connection using CQL shell:
cqlsh
Step 6: Basic Cassandra Commands
Once Cassandra is running, you can use basic commands to create a database and insert sample data.
CREATE KEYSPACE testdb WITH replication = {'class':'SimpleStrategy', 'replication_factor' : 1};
USE testdb;
CREATE TABLE users (id UUID PRIMARY KEY, name text, email text);
INSERT INTO users (id, name, email) VALUES (uuid(), 'John Doe', '[email protected]');
SELECT * FROM users;