How to Install Apache Cassandra on RHEL-Compatible Linux
In this article, we'll explain how to install Apache Cassandra on a Red Hat Enterprise Linux (RHEL) server using the Yum package manager We'll also be locking its version to prevent accidental upgrades.
In this article, we'll explain how to install Apache Cassandra on Red Hat Enterprise Linux (RHEL) using the yum/dnf package manager. We'll also show you how to lock its version to avoid unintentional upgrades.
Prerequisites:
- An RHEL Linux (compatible) distribution is installed on a server or virtual machine.
- Root access or a user account with sudo privileges (In this example, we use a user account with sudo privileges).
Let's get started!
Update Your System
Before installing Apache Cassandra, updating your system is vital. Open a terminal and run the following command:
sudo yum update -y
Install a Java Development Kit (JDK)
Apache Cassandra requires Java to be installed on your system. Install OpenJDK 8 or OpenJDK 11 using one of the following commands:
sudo yum install java-1.8.0-openjdk-devel -y
or
sudo yum install java-11-openjdk-devel -y
Apache Cassandra / Java Version Matrix
- Apache Cassandra 3.11
- Java 8 is the recommended version for Cassandra 3.11.
- Java 11 is also supported, but it is not as widely used and tested as Java 8.
- Apache Cassandra 4.0 and 4.1
- Java 8 and Java 11 are both supported and recommended for this version of Cassandra.
Verify the Java installation by running the following:
java -version
Add the Apache Cassandra Repository
To add the Apache Cassandra repository, run the following commands:
sudo tee /etc/yum.repos.d/cassandra.repo <<EOL
[cassandra_<version>]
name=Apache Cassandra
baseurl=https://www.apache.org/dist/cassandra/redhat/<version>/
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.apache.org/dist/cassandra/KEYS
EOL
- Replace
<version>
with the desired Cassandra version (e.g., 311x for 3.11, 40x for 4.0, or 41x for 4.1).
Note: The YUM repository will differ based on the version of Cassandra you want to install. Replace the baseurl with the appropriate version code (e.g., 311x for 3.11, 40x for 4.0, or 41x for 4.1).
Install Apache Cassandra
Now that the repository is set up install Apache Cassandra using the following command:
sudo yum install cassandra cassandra-tools -y
Optional (but highly recommended): Lock the Apache Cassandra Version
To prevent accidental upgrades of Apache Cassandra, you can lock its version using the yum versionlock plugin. First, check the installed version of Cassandra:
sudo yum list installed cassandra
Lock the Apache Cassandra version by running the following:
sudo yum versionlock add cassandra
You can confirm that the version is locked by checking the status of the package:
sudo yum versionlock list
To unlock the version in the future, use the following command:
sudo yum versionlock delete cassandra
Congratulations! You have successfully installed Apache Cassandra on your RHEL Linux distribution and locked its version to prevent accidental upgrades. Please consult the official documentation for further instructions to start the Cassandra process.
Here is the official Apache Cassandra documentation link for further configuration, usage, and maintenance information.
Stay tuned for our blog post covering basic configuration settings for Apache Cassandra.