How to Install Apache Cassandra on Rocky Linux 10, 9 and 8

Install Apache Cassandra on Rocky Linux 10, 9 and 8 using the official repository. Includes cqlsh setup, systemd service, and authentication.

Last updatedAuthorJoshua JamesRead time7 minGuide typeRocky Linux

Apache Cassandra is useful when one database node is not enough: it keeps writes available during node failures and scales by adding more machines to the cluster. To install Apache Cassandra on Rocky Linux, use the official Apache RPM repository, pair it with a supported Java 17 runtime, then start the packaged service through systemd.

These steps support Rocky Linux 10, 9, and 8. Cassandra 5.0 is the default branch for new installs, while the older 4.1 and 4.0 repository branches remain available for compatibility work that cannot move to 5.0 yet.

Install Apache Cassandra on Rocky Linux

The official Apache RPM repository provides one branch per Cassandra release line. Pick the branch before writing the repository file because the same package name, cassandra, comes from whichever branch you enable.

Cassandra BranchRPM Repository PathJava RuntimeBest Fit
5.0.x50xJava 11 or 17New deployments and current features
4.1.x41xJava 8 or 11Existing applications pinned to 4.1 behavior
4.0.x40xJava 8 or 11Legacy compatibility where 4.0 is required

Cassandra installs on Rocky Linux 10, 9, and 8, but the Java source differs. Rocky Linux 9 and 8 provide OpenJDK 17 in AppStream. Rocky Linux 10 currently provides Java 21 in its base repositories, so use Eclipse Temurin 17 for Cassandra 5.0 on Rocky Linux 10.

Update Rocky Linux Before Installing Cassandra

Refresh package metadata and apply available updates before adding the Cassandra repository:

sudo dnf upgrade --refresh

The sudo command runs package and service changes with administrator privileges. Keep using the same admin-capable account for the remaining commands.

Install the helper packages used later for service enablement and key handling:

sudo dnf install chkconfig curl gnupg2 -y

The chkconfig package supplies the SysV compatibility helper that systemctl enable cassandra needs on Rocky Linux 10 and 9. The curl and gnupg2 packages handle the Apache signing key import later in the install.

Install Java 17 on Rocky Linux 9 or 8

Rocky Linux 9 and 8 can use the OpenJDK 17 headless package from AppStream:

sudo dnf install java-17-openjdk-headless -y

Install Java 17 on Rocky Linux 10

Rocky Linux 10 needs a Java 17 repository for Cassandra 5.0. Add the Eclipse Temurin RPM repository from Adoptium’s Linux installation instructions:

sudo tee /etc/yum.repos.d/adoptium.repo > /dev/null <<'EOF'
[Adoptium]
name=Adoptium
baseurl=https://packages.adoptium.net/artifactory/rpm/centos/10/$basearch
enabled=1
gpgcheck=1
gpgkey=https://packages.adoptium.net/artifactory/api/gpg/key/public
EOF

Install the Temurin 17 JDK package. The full JDK is intentional because it satisfies the Cassandra RPM dependency on Rocky Linux 10; the smaller Temurin JRE package alone can leave DNF pulling in another JDK branch to complete the transaction.

sudo dnf install temurin-17-jdk

If DNF prompts to import the Adoptium signing key, verify the fingerprint before accepting it: 3B04 D753 C905 0D9A 5D34 3F39 843C 48A5 65F8 F04B.

Verify that the active Java runtime is version 17 before continuing:

java -version 2>&1 | head -n 1

The output should report Java 17. The vendor suffix can differ between the Rocky Linux OpenJDK package and Eclipse Temurin:

openjdk version "17.0.19" 2026-04-21 LTS

Import the Apache Cassandra RPM Signing Key

Apache publishes a combined Cassandra KEYS file for multiple release managers. Current Rocky Linux releases can reject that full key bundle when DNF reads it directly, so export the current Cassandra RPM signing key into a local RPM key file instead:

tmpdir=$(mktemp -d)
GNUPGHOME="$tmpdir/gnupg"
mkdir -m 700 "$GNUPGHOME"

curl -fsSL https://downloads.apache.org/cassandra/KEYS -o "$tmpdir/apache-cassandra.KEYS"
gpg --batch --homedir "$GNUPGHOME" --import "$tmpdir/apache-cassandra.KEYS" >/dev/null
gpg --batch --homedir "$GNUPGHOME" --armor --export 7464AAD9068241C50BA6A26232F35CB2F546D93E | sudo tee /etc/pki/rpm-gpg/RPM-GPG-KEY-apache-cassandra >/dev/null
rm -rf "$tmpdir"

sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-apache-cassandra

Confirm that RPM now lists the Cassandra signing key:

rpm -q gpg-pubkey --qf '%{VERSION}-%{RELEASE}\n' | grep -i f546d93e
f546d93e-63d4273d

The full fingerprint for this Cassandra RPM signing key is 7464 AAD9 0682 41C5 0BA6 A262 32F3 5CB2 F546 D93E.

Add the Apache Cassandra 5.0 RPM Repository

Create the DNF repository file for Cassandra 5.0 using the Apache Cassandra RPM repository and the local key file:

sudo tee /etc/yum.repos.d/cassandra.repo > /dev/null <<'EOF'
[cassandra]
name=Apache Cassandra
baseurl=https://redhat.cassandra.apache.org/50x/
enabled=1
gpgcheck=1
repo_gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-apache-cassandra
EOF

Keep repo_gpgcheck=0 for this repository. Package signatures still use gpgcheck=1, but repository metadata signature verification currently fails against the Apache Cassandra RPM metadata. Do not replace this with --nogpgcheck, which disables RPM package signature verification.

For Cassandra 4.1 or 4.0, change only the baseurl line to https://redhat.cassandra.apache.org/41x/ or https://redhat.cassandra.apache.org/40x/. Do not enable multiple Cassandra branch repositories at the same time.

Confirm that DNF sees the Cassandra candidate from the repository:

dnf --repo=cassandra repoquery --qf '%{name} %{evr} %{arch} %{repoid}' cassandra

Cassandra publishes point releases through the same branch, so your patch version may be newer. Relevant output currently includes:

cassandra 5.0.8-1 noarch cassandra

Install the Cassandra RPM Package

Install Cassandra with DNF. The repository keeps package signature checking enabled through the local Apache key imported earlier.

sudo dnf install cassandra

Verify the installed Cassandra version and RPM state:

cassandra -v
rpm -q cassandra

Your patch version can move as Apache publishes 5.0.x updates. Relevant output currently includes:

5.0.8
cassandra-5.0.8-1.noarch

Manage the Cassandra Service on Rocky Linux

The Apache RPM installs a SysV init script at /etc/rc.d/init.d/cassandra. On Rocky Linux, systemd generates a compatibility unit named cassandra.service, so you can manage Cassandra with normal systemctl commands.

Reload systemd and start Cassandra:

sudo systemctl daemon-reload
sudo systemctl start cassandra
systemctl is-active cassandra

A running service returns:

active

Enable Cassandra to start during boot:

sudo systemctl enable cassandra
systemctl is-enabled cassandra

After chkconfig is installed, the enable check returns:

enabled

Cassandra can take 30 to 60 seconds to finish its first startup. Check the node state with nodetool:

nodetool status

A single-node install should show the local node as up and normal:

Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load        Tokens  Owns (effective)  Host ID                               Rack
UN  127.0.0.1  114.72 KiB  16      100.0%            ff1ff00b-283c-4a40-aa70-91afe187e825  rack1

Use cqlsh for Cassandra Queries

The RPM includes /usr/bin/cqlsh, but the best client path depends on the Rocky Linux release. Rocky Linux 8 can use the packaged client. Rocky Linux 9 and 10 should use the standalone PyPI client because the packaged script can fail before it connects.

Use Packaged cqlsh on Rocky Linux 8

Rocky Linux 8 can run the bundled client from the Cassandra RPM:

/usr/bin/cqlsh --version

The packaged client can warn about Python 3.6, but it still reports its version:

Warning: using deprecated version of Python: 3.6
cqlsh 6.2.0

Connect to the local Cassandra service and print the server version:

/usr/bin/cqlsh -e "SHOW VERSION"
Warning: using deprecated version of Python: 3.6
[cqlsh 6.2.0 | Cassandra 5.0.8 | CQL spec 3.4.7 | Native protocol v5]

Install Standalone cqlsh on Rocky Linux 9 or 10

Rocky Linux 9 and 10 need the standalone client from PyPI. Install pip, then install cqlsh for your Linux user:

sudo dnf install python3-pip -y
python3 -m pip install --user --upgrade cqlsh

Verify the user-local client. The exact patch version can differ between Rocky Linux 9 and 10:

~/.local/bin/cqlsh --version

Example output:

cqlsh 6.2.2

Connect to the local Cassandra service and print the server version:

~/.local/bin/cqlsh -e "SHOW VERSION"

A patch-level compatibility warning can appear when the client targets Cassandra 5.0.0 and the server is a newer 5.0.x build. The connection is working when the version banner appears:

WARNING: cqlsh was built against 5.0.0, but this server is 5.0.8.  All features may not work!
[cqlsh 6.2.2 | Cassandra 5.0.8 | CQL spec 3.4.7 | Native protocol v5]

Configure Cassandra Basics on Rocky Linux

Cassandra stores its active configuration through the /etc/cassandra/conf alternatives link, which points to /etc/cassandra/default.conf for the RPM package. Runtime data lives in /var/lib/cassandra, logs in /var/log/cassandra, and the default service listens on localhost for CQL traffic.

Back up the main configuration file before changing authentication, cluster names, network addresses, or storage paths:

sudo cp /etc/cassandra/conf/cassandra.yaml /etc/cassandra/conf/cassandra.yaml.backup

Review Cassandra Network Ports

A fresh single-node install keeps the important listeners on localhost. Cassandra commonly uses TCP port 9042 for CQL clients, 7000 for internode communication, and 7199 for JMX. Do not open these ports broadly in firewalld until you have configured authentication, node listen addresses, and trusted source ranges for your deployment.

grep -E '^(listen_address|rpc_address|native_transport_port|storage_port):' /etc/cassandra/conf/cassandra.yaml

The default single-node values include:

listen_address: localhost
native_transport_port: 9042
storage_port: 7000
rpc_address: localhost

Enable Password Authentication

Cassandra starts with AllowAllAuthenticator and AllowAllAuthorizer, which is convenient for a local lab but unsafe for any reachable service. For a single-node server, edit cassandra.yaml and switch to password authentication:

sudo nano /etc/cassandra/conf/cassandra.yaml

Use these values:

authenticator: PasswordAuthenticator
authorizer: CassandraAuthorizer
role_manager: CassandraRoleManager
roles_validity: 0ms
permissions_validity: 0ms

For multi-node clusters, increase the system_auth keyspace replication factor before relying on password authentication. A single replica of authentication data can lock users out during node failures.

Restart Cassandra after saving the file:

sudo systemctl restart cassandra

Connect with the default administrative account. Enter cassandra when cqlsh prompts for the password.

~/.local/bin/cqlsh -u cassandra

Create a new superuser, then sign in with that account before disabling the default login:

CREATE ROLE admin WITH PASSWORD = 'replace-this-password' AND SUPERUSER = true AND LOGIN = true;

Exit cqlsh, reconnect as the new account, then disable the default cassandra role:

~/.local/bin/cqlsh -u admin
ALTER ROLE cassandra WITH LOGIN = false AND SUPERUSER = false;

Update or Remove Apache Cassandra

Update Cassandra Within the Same Branch

DNF handles point-release updates from the enabled Cassandra branch. Apply package updates, restart the service, then verify the installed version:

sudo dnf upgrade cassandra
sudo systemctl restart cassandra
cassandra -v

Major upgrades, such as moving from Cassandra 4.1 to 5.0, need release-note review, config review, and data-format checks alongside the Apache Cassandra operating documentation. Do not switch the repository branch on a production node without a tested upgrade plan and backups.

Remove Cassandra Packages and Repositories

Stop Cassandra, disable boot startup, then remove the RPM package:

sudo systemctl stop cassandra
sudo systemctl disable cassandra
sudo dnf remove cassandra

Verify that the package is no longer installed:

rpm -q cassandra || true

Expected output after removal:

package cassandra is not installed

Remove the Cassandra repository file and the local Cassandra RPM key file. The RPM database key removal is safe only after Cassandra packages are gone and no other Cassandra repository still uses this key.

sudo rm -f /etc/yum.repos.d/cassandra.repo
sudo rm -f /etc/pki/rpm-gpg/RPM-GPG-KEY-apache-cassandra

cassandra_key=$(rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\n' | grep -i f546d93e || true)

if [ -n "$cassandra_key" ]; then
    sudo rpm -e "$cassandra_key"
fi

Confirm that the Cassandra repository is no longer enabled:

dnf repolist --enabled | grep -i cassandra || echo "Cassandra repository is not enabled"
Cassandra repository is not enabled

On Rocky Linux 9 or 8, remove OpenJDK 17 only if Cassandra was the only workload using that Java runtime:

sudo dnf remove java-17-openjdk-headless

On Rocky Linux 10, remove the Adoptium repository and Temurin package only if nothing else on the server depends on that Java build. The key removal check leaves the Adoptium key in place when other Temurin packages remain installed.

sudo dnf remove temurin-17-jdk
sudo rm -f /etc/yum.repos.d/adoptium.repo

if ! rpm -qa 'temurin-*' | grep -q .; then
    adoptium_key=$(rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\n' | grep -i 65f8f04b || true)

    if [ -n "$adoptium_key" ]; then
        sudo rpm -e "$adoptium_key"
    fi
fi

Remove the user-installed cqlsh client on Rocky Linux 9 or 10 if you no longer need it. Remove python3-pip only when no other Python workflow on the server depends on it.

python3 -m pip uninstall -y cqlsh cassandra-driver
sudo dnf remove python3-pip

Remove chkconfig only if no remaining SysV-style services on the machine need systemd enablement support:

sudo dnf remove chkconfig

Delete Cassandra Data and Configuration

The following cleanup permanently deletes Cassandra databases, commit logs, caches, logs, and configuration files. Back up anything you need before removing these paths.

Preview the remaining Cassandra paths first:

sudo find /var/lib/cassandra /var/log/cassandra /etc/cassandra -maxdepth 0 -print 2>/dev/null

If the listed paths belong only to the Cassandra install you are removing, delete them:

sudo rm -rf /var/lib/cassandra /var/log/cassandra /etc/cassandra

Remove user-level cqlsh settings only if you no longer need saved Cassandra connection profiles for that Linux account:

rm -rf ~/.cassandra

Troubleshoot Cassandra on Rocky Linux

Bundled cqlsh Fails on Rocky Linux 9 or 10

The RPM-bundled /usr/bin/cqlsh can fail before it connects on newer Rocky Linux releases. Rocky Linux 9 can show a missing module error:

ModuleNotFoundError: No module named 'cqlshlib'

Rocky Linux 10 can show a Python version error:

Warning: unsupported version of Python, required 3.6-3.11 but found 3.12
No appropriate Python interpreter found.

Use the user-installed PyPI client instead:

sudo dnf install python3-pip -y
python3 -m pip install --user --upgrade cqlsh
~/.local/bin/cqlsh --version

Cassandra Service Fails to Start

If Cassandra does not start, check the service state and recent logs:

systemctl is-active cassandra
sudo tail -n 50 /var/log/cassandra/system.log

Java version mismatches are a common cause. Confirm that java -version reports Java 17 for Cassandra 5.0, then restart the service.

java -version
sudo systemctl restart cassandra
systemctl is-active cassandra

cqlsh Reports Connection Refused

A connection refused error usually means Cassandra is still starting or is not listening on the expected local address. Check the service and look for the startup-complete log line:

systemctl is-active cassandra
sudo tail -n 50 /var/log/cassandra/system.log | grep -E 'Startup complete|Starting listening|ERROR|Exception'

Relevant startup lines include:

Starting listening for CQL clients on localhost/127.0.0.1:9042 (unencrypted)...
Startup complete

If you are reading logs often while troubleshooting, the tail command examples guide covers follow mode, line counts, and safer filtering patterns.

DNF Reports Cassandra GPG or Metadata Errors

If DNF cannot verify Cassandra packages, first confirm that the local Cassandra key is imported. If this command prints nothing, repeat the signing-key import section before reinstalling.

rpm -q gpg-pubkey --qf '%{VERSION}-%{RELEASE}\n' | grep -i f546d93e
f546d93e-63d4273d

Then confirm that the repository still points at the local key file and keeps package signature checks enabled:

grep -E '^(gpgcheck|repo_gpgcheck|gpgkey)=' /etc/yum.repos.d/cassandra.repo
gpgcheck=1
repo_gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-apache-cassandra

Clean metadata and retry the transaction after the key and repository file match:

sudo dnf clean metadata
sudo dnf --repo=cassandra makecache
sudo dnf install cassandra

Conclusion

Apache Cassandra is running on Rocky Linux with Java 17, the official Apache RPM package, systemd service management, and a working cqlsh client. Before moving beyond a local node, lock down authentication, review listen addresses and firewalld exposure, and plan backups or a staged upgrade path from the Apache Cassandra documentation. Java application projects can also pair this setup with Apache Maven on Rocky Linux.

Share this guide

Help another Linux user troubleshoot faster

Share this guide with someone troubleshooting Linux systems or saving it for later.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Verify before posting: