The Apache Cassandra can be installed on the Linux distributions and in this article, we will explore the method of installing the Apache Cassandra on Ubuntu 22.04.
How to install Apache Cassandra on Ubuntu 22.04
To install the Apache Cassandra on Ubuntu 22.04, we will use its official repository and with the help of the apt package manager, we will install it. Firstly, we will update packages list on the Ubuntu 22.04 with the update command:
As Apache Cassandra is written in Java so we need to have Java installed on our machine. To install Java, use:
After the Java package is installed, we will import the GPG keys using the command:
After importing the key of the Cassandra, we will add the repository of the Apache Cassandra in the default sources list of Ubuntu using the command:
Then we will update the Ubuntu using the command:
Apache Cassandra is ready to install on the Ubuntu, so we will use the command:
To check the status of the installed Cassandra, we will use the command:
How to access the Apache Cassandra on the Ubuntu 22.04
By default, the directory of the Apache Cassandra is located at /etc/cassandra, data will be stored at /var/lib/cassandra and to access the Apache Cassandra, we will use the command:
In the above output, we can observe that the cluster name is set to the “Test Cluster”, which can be changed to the “Linuxhint Cluster”, by using the command:
UPDATE system.local SET cluster_name = ‘LinuxHint Cluster’ WHERE KEY = ‘local’;
And then we will exit the Apache database using:
Now the time is to change the name to “LinuxHint” in the configuration files by using the command:
In the open file, replace the “Test Cluster” with the “LinuxHint Cluster”:
Finally, we will restart the Apache Cassandra:
And open the Cassandra database using the command:
Now we can see that the name has been changed and if we want to delete the Apache Cassandra then we can do so by using the command:
Conclusion
The Apache Cassandra is a NoSQL database which can handle a large amount of the data quite conveniently. In this write-up, the Apache Cassandra has been installed on the latest release of the Ubuntu which is 22.04 using the terminal, and also learned the method of changing the cluster name of Cassandra.