How to install Apache Cassandra on Ubuntu Linux Systems. Here is your guide for Cassandra installation on Linux Ubuntu Systems.
Apache Cassandra database is the right choice when you need scalability and high availability without compromising performance. Linear scalability and proven fault-tolerance on commodity hardware or cloud infrastructure make it the perfect platform for mission-critical data. Cassandra’s support for replicating across multiple datacenters is best-in-class, providing lower latency for your users and the peace of mind of knowing that you can survive regional outages.
Prerequisites – Install Apache Cassandra on Ubuntu
1. Install the latest version of Java 8, either the Oracle Java Standard Edition 8 or OpenJDK 8. To verify that you have the correct version of java installed, type java -version.
2. NOTE: Experimental support for Java 11 was added in Cassandra 4.0 (CASSANDRA-9608). Running Cassandra on Java 11 is experimental. Do so at your own risk. For more information, see NEWS.txt.
3. For using cqlsh, the latest version of Python 2.7 or Python 3.6+. To verify that you have the correct version of Python installed, type python –version.
Installing Cassandra : the Binary Tarball
Installing the binary tarball is the simplest choice. The tarball unpacks all its contents into a single location with binaries and configuration files located in their own subdirectories.
Begin with the first step – Verify the version of Java installed.
$ java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~16.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
If Java is not installed, run the following set of commands to install Java:
sudo apt update
sudo apt install openjdk-8-jdk
Once installed, verify the Java installation:
java -version
Download the binary tarball from one of the mirrors on the Apache Cassandra Download site. For example, to download 4.0:
$ curl -OL http://apache.mirror.digitalpacific.com.au/cassandra/4.0.0/apache-cassandra-4.0.0-bin.tar.gz
$ tar xzvf apache-cassandra-4.0.0-bin.tar.gz
Once installed, run the following command to start Cassandra (this will run Cassandra as the authenticated Linux user):
$ cd apache-cassandra-4.0.0/
$ bin/cassandra
Cassandra is ready when you see an entry like this in the system.log:
INFO [main] 2019-12-17 03:03:37,526 Server.java:156 - Starting listening for CQL clients on localhost/127.0.0.1:9042 (unencrypted)...
Check the status of Cassandra:
$ bin/nodetool status
The status column in the output should report UN which stands for “Up/Normal”.
Alternatively, connect to the database with:
$ cqlsh
Note
1. Packaged installations require root permissions. Install the RPM build on CentOS and RHEL-based distributions if you want to install Cassandra using YUM.
2. Install the Debian build on Ubuntu and other Debian-based distributions if you want to install Cassandra using APT.
3. Note that both the YUM and APT methods required root permissions and will install the binaries and configuration files as the cassandra OS user.
Installing Cassandra : Second Method
Alternatively, you can also install Apache Cassandra on Ubuntu 20.04 using the following set of commands:
$ sudo apt upgrade
$ sudo apt update
$ sudo apt install apt-transport-https
$ sudo apt update
$ 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'
$ sudo apt update
$ sudo apt install cassandra
Note that after successful installation, the Apache Cassandra service will automatically. Run the following command to verify:
$ nodetool status