Apache Cassandra is a highly scalable, distributed NoSQL database designed to handle large amounts of data across many servers. It offers high availability and no single point of failure. This guide covers installation steps on Ubuntu 18.04, the latest Ubuntu LTS (24.04), CentOS 7, and AlmaLinux 9.

Prerequisites

Before you begin:

  • A server running one of the supported OS versions.
  • Root or sudo user access.
  • Java Development Kit (OpenJDK 8 or 11) installed.

1. Install Java

On Debian-based systems:

sudo apt update
sudo apt install -y openjdk-11-jdk

On RHEL-based systems:

sudo yum update
sudo yum install -y java-11-openjdk

Verify Java installation:

java -version

2. Installation on Ubuntu 18.04

Add the Apache Cassandra repository and key:

curl https://downloads.apache.org/cassandra/KEYS | sudo apt-key add -
echo "deb https://downloads.apache.org/cassandra/debian 40x main" | sudo tee /etc/apt/sources.list.d/cassandra.list

Update and install:

sudo apt update
sudo apt install -y cassandra

Start and enable the service:

sudo systemctl start cassandra
sudo systemctl enable cassandra

Check status:

sudo systemctl status cassandra

3. Installation on Latest Ubuntu (24.04 LTS)

Use the same steps as Ubuntu 18.04 to add the repository, install Cassandra, and start the service.

4. Installation on CentOS 7

Create the repository file:

sudo tee /etc/yum.repos.d/cassandra.repo <<EOF
[cassandra]
name=Apache Cassandra
baseurl=https://downloads.apache.org/cassandra/redhat/40x/
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://downloads.apache.org/cassandra/KEYS
EOF

Install, start, and enable:

sudo yum install -y cassandra
sudo systemctl start cassandra
sudo systemctl enable cassandra
sudo systemctl status cassandra

5. Installation on AlmaLinux 9

Use the same `/etc/yum.repos.d/cassandra.repo` as CentOS 7, then:

sudo dnf install -y cassandra
sudo systemctl start cassandra
sudo systemctl enable cassandra
sudo systemctl status cassandra

6. Post-Installation Check

Connect with cqlsh:

cqlsh

You should see a prompt like:

Connected to Test Cluster at 127.0.0.1:9042.
[ cqlsh 5.0.1 | Cassandra 4.0.7 | CQL spec 3.4.5 | Native protocol v4 ]

Conclusion

You now have Apache Cassandra installed on your chosen Linux distribution. For production workloads, a dedicated server offers optimal performance and reliability. Our unmanaged dedicated servers start from just 20 USD per month. 

?האם התשובה שקיבלתם הייתה מועילה 50 משתמשים שמצאו מאמר זה מועיל (56 הצבעות)