• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install Apache Cassandra on Ubuntu 20.04

Written by Admin, Updated On August 18, 2020
cassandra, database, java, ubuntu
How to Install Apache Cassandra on Ubuntu 20.04

Apache Cassandra is an open-source NoSQL database system with high availability and without compromising performance. It is used by many large companies like Github, NetFlix, Reddit and Instagram. In this described how to install Apache Cassandra on Ubuntu 20.04.

Prerequisites#

You should logged in as root or user with sudo privileges.

Step 1 – Install Java#

To install the latest Apache Cassandra version 3.11 requires OpenJDK 8 to be installed on your Ubuntu system. So first we will install OpenJDK by running following command:

sudo apt update
sudo apt install openjdk-8-jdk

Once the process completed, verify the Java installation by typing:

java -version

The output should look something like this:

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 – 2 Add Repository & Import GPG Key#

Next, you need to add repository for the Apache Cassandra and import the GPG key to the 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'

It will not return any output.

Step 3 – Install Apache Cassandra#

You are now ready to install Cassandra on Ubuntu.

Update the repository package list:

sudo apt update

Finally, run the following command to install Apache Cassandra:

sudo apt install Cassandra

Apache Cassandra service will automatically start after the installation process is complete.

Step 4 – Verify Apache Cassandra Installation#

After that, to check the Cassandra installed and running properly, type:

nodetool status

It should show output something like below:

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

That’s it. At this step, Apache Cassandra is installed on your Ubuntu server.

Step 5 – Configuring Apache Cassandra#

The configuration files are located in /etc/cassandra and /var/lib/cassandra directory holds the Apache Cassandra data files. You can configure the Java start-up options in the /etc/default/cassandra file.

If the database is running on the same host then you don’t need to change anything in the configuration. By default, Cassandra is configured to listen on localhost only.

To make connection with Cassandra using CQL you can use the default command-line tool cqlsh which is shipped with the Cassandra package.

cqlsh
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>

Conclusion#

You have learned how to install Apache Cassandra on Ubuntu 20.04. To learn more about Cassandra, visit the official Apache Cassandra Documentation page.

If you have a problem or suggestion, please leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Create and List Local and Remote Git Branches
Next Article   How to Install Memcached on Debian 10

Related Posts

  • How to Install Apache, MySQL, PHP (LAMP) on Ubuntu 22.04

    How to Install LAMP on Ubuntu 22.04

    March 20, 2023
  • How to Install LEMP Stack on Ubuntu 22.04

    How to Install LEMP Stack on Ubuntu 22.04

    March 18, 2023
  • How to Install Memcached on Ubuntu 22.04

    How to Install Memcached on Ubuntu 22.04

    March 16, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install Microsoft Edge Browser on Ubuntu 22.04
    How to Install Microsoft Edge Browser on Ubuntu 22.04 March 14, 2023
  • How to Install Ruby on Ubuntu 22.04 LTS
    How to Install Ruby on Ubuntu 22.04 LTS February 27, 2023
  • How to Install LEMP Stack on Ubuntu 22.04
    How to Install LEMP Stack on Ubuntu 22.04 March 18, 2023
  • How to Install Set Up Apache Virtual Hosts on Ubuntu 22.04
    How to Set Up Apache Virtual Hosts on Ubuntu 22.04 March 2, 2023
  • How to Install MariaDB on Debian 11 Bullseye
    How to Install MariaDB on Debian 11 Bullseye March 8, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook