How to Install Apache Cassandra on Ubuntu 20.04 | 18.04

How to Install Apache Cassandra on Ubuntu 20.04

In this article, we are going to show you that how to Install Apache Cassandra on Ubuntu 20.04. If you want to learn about Installing Apache Cassandra on Ubuntu then this article is ideal for you.

Apache Cassandra is a free and open-source, distributed, wide column store, NoSQL database system with high availability and without compromising performance and it is designed to handle large amounts of data. It is used by many large and popular companies like Github, NetFlix and Instagram and many more.

Install Apache Cassandra on Ubuntu 20.04


Step 1 : Prerequisites

To install Apache Cassandra, you must need to logged in with root or user with sudo privileges.


Step 2 : Install Java

Apache Cassandra version 3.11 requires OpenJDK 8 to be installed on your system. So first you need to install OpenJDK by running below command:

sudo apt update
sudo apt install openjdk-8-jdk

To verify that Java is install or not, run the below command:

java -version

The above command give a output something like below:

Output
openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0ubuntu2~20.04-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)

Step : 3 Install Apache Cassandra

To install the necessary dependencies to add a new repository over HTTPS, run the below command:

sudo apt install apt-transport-https

After install the necessary dependencies. Now import the repository’s GPG key and add the Cassandra repository to the your system:

wget -q -O - https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
sudo sh -c 'echo "deb http://www.apache.org/dist/cassandra/debian 311x main" > /etc/apt/sources.list.d/cassandra.list'

Now update the packages list and install the Apache Cassandra by running the below command:

sudo apt update
sudo apt install cassandra

Step 4 : Verify Apache Cassandra Installation

After the installation process. You can verify it by running below command:

nodetool status

When you run above command, it will give a output something like below:

Output
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load    Tokens  Owns (effective)  Host ID                               Rack
UN  127.0.0.1  70 KiB  256     100.0%            2eaab399-be32-49c8-80d1-780dcbab694f  rack1

Step 5 : Configuring Apache Cassandra

  • Apache Cassandra data and information is stored at –  /var/lib/cassandra directory
  • Configuration files are located at – /etc/cassandra
  • Java start-up options located at – /etc/default/cassandra

By default Cassandra is configured to listen on localhost only. If the client connecting to the database is also running on the same host then you don’t need to change its default configuration file.

To connect with Cassandra through CQL (the Cassandra Query Language) then you can use a command-line tool named cqlsh that is comes with the Cassandra package.

cqlsh
Output
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.7 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh>

That’s all

If you face any error and issue in above steps , please use comment box below to report.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top