This brief tutorial shows students and new users how to install Apache Cassandra on Ubuntu 20.04 | 18.04.
Apache Cassandra is a free and open-source, distributed NoSQL database system with high availability across multiple systems, thus eliminating a single failure point.
One may want to install Apache Cassandra on Ubuntu Linux for several reasons. Firstly, Apache Cassandra is a powerful and scalable NoSQL database system used by many small and large companies that process massive amounts of data.
If you need a database management system with scalability and high availability, then Apache Cassandra is worth considering. Secondly, Ubuntu Linux is a popular and reliable operating system widely used for web and application servers.
Installing Apache Cassandra on Ubuntu Linux can provide a stable and secure environment for running your database. Lastly, Apache Cassandra is free and open-source software that can be downloaded and used without licensing fees.
This makes it a cost-effective option for those who need a powerful database management system but do not have the budget for commercial software.
For more about Apache Cassandra, please visit its homepage.
Follow the steps below to get Apache Cassandra installed on Ubuntu
Install JAVA
To get the latest version of Apache Cassandra, you can either use it.DEB file from its website or add its official repository to Ubuntu. However, you will need Oracle JAVA installed on the system for Cassandra to work.
The open-source version of Oracle JAVA works great with Cassandra, so for this tutorial, we will be using OpenJDK 8.
To install OpenJDK 8, run the commands below:
sudo apt update sudo apt install openjdk-8-jdk
To verify if OpenJDK is installed and running, run the commands below:
java -version
It should print out the lines similar to the ones below:
openjdk version "1.8.0_191" OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12) OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
After installing OpenJDK 8, continue below to install Apache Cassandra.
Installing Apache Cassandra
Now that JAVA is installed, follow the steps below to get Apache Cassandra installed and configured.
Suppose you don’t want to install the Cassandra from it manually.DEB file, then add Cassandra’s official package repository to make installing and updating it easier.
To add the Apache Cassandra repository and key, run the commands below. The first line imports the repository’s GPG key. The second adds the Apache Cassandra repository into a new file called cassandra.sources.list.
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.sources.list'
After the steps above, run the commands below to install them.
sudo apt update sudo apt install cassandra
That should do it!
To verify if Cassandra is correctly installed, run the commands below:
nodetool status
You should see a similar screen print as the one below:
Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Tokens Owns (effective) Host ID Rack UN 127.0.0.1 103.68 KiB 256 100.0% bbdd9509-523a-45ac-a03f-64c478515de9 rack1
That’s how you know Cassandra is installed and running.
To interact with Cassandra through CQL (the Cassandra Query Language), you can use a command line utility named cqlsh
cqlsh
You should log on to the CQL terminal screen.
Connected to Test Cluster at 127.0.0.1:9042.
Use HELP for help. cqlsh>
Conclusion:
- Apache Cassandra offers a powerful, scalable NoSQL database solution suitable for handling vast amounts of data.
- The installation process on Ubuntu 20.04 or 18.04 is straightforward, requiring only a few command-line entries.
- By utilizing OpenJDK 8, you can effectively support Cassandra’s operations with minimal setup hassle.
- Once installed, Apache Cassandra provides high availability and eliminates single points of failure.
- Users can easily manage and interact with the database using CQL through the
cqlsh
utility. - As a free and open-source system, Apache Cassandra is a cost-effective choice for businesses looking to implement a robust database without incurring licensing fees.
- For further exploration and resources, the Apache Cassandra homepage is a valuable reference.
Leave a Reply