In this article, we will have explained the necessary steps to install and configure Apache Cassandra on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
Apache Cassandra has been developed as a database manager that gives us key aspects such as scalability and high availability, but with adequate performance regardless of the size of the databases to work with. The Cassandra supports relational databases including MySQL, PostgreSQL and Microsoft SQL and Cassandra is used by a number of organizations including Apple, NetFlix, eBay, and many more.
Install Apache Cassandra on Ubuntu 20.04
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo apt update sudo apt upgrade sudo apt install apt-transport-https
Step 2. Install Java.
We install OpenJDK 8 with the following command:
sudo apt install openjdk-8-jdk
Verify the Java installation:
Step 2. Install Apache Cassandra on the Ubuntu system.
Installing Cassandra on Ubuntu is very easy, now import the repository’s GPG key and add the Cassandra repository 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'
Finally, we’re ready to install Cassandra on the Ubuntu system:
sudo apt update sudo apt install cassandra
Apache Cassandra will start automatically and we can validate its status with the following command:
sudo systemctl status cassandra
Now we can validate the state of the node with the following command. This allows us to see the status of Cassandra’s node:
sudo nodetool status
Step 3. Configure Apache Cassandra.
Apache Cassandra data is stored in the
/var/lib/cassandra directory, configuration files are located in
/etc/cassandra and Java start-up options can be configured in the
To interact with Cassandra through CQL (the Cassandra Query Language) you can use a command-line utility named
cqlsh that is shipped with the Cassandra package:
Connected to Test Cluster at 127.0.0.1:9042. [cqlsh 5.2.1 | Cassandra 3.11.8 | CQL spec 3.4.6 | Native protocol v4] Use HELP for help. cqlsh>
Congratulation, you have learned how to install and use Apache Cassandra on Ubuntu 20.04 Focal Fossa. If you have any questions, please leave a comment below.