Installing Apache Cassandra on Ubuntu (Linux) Machine

Apache Cassandra Installation

Installing the binary tarball

  1. Verify the version of Java installed. For example:

  • Command

$ java -version

Result

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)

2. Download the binary tarball from one of the mirrors on the Apache Cassandra Download site. For example, to download Cassandra 4.0.1:

$ curl -OL https://dlcdn.apache.org/cassandra/4.0.1/apache-cassandra-4.0.1-bin.tar.gz

The mirrors only host the latest versions of each major supported release. To download an earlier version of Cassandra, visit the Apache Archives.

  1. OPTIONAL: Verify the integrity of the downloaded tarball using one of the methods here. For example, to verify the hash of the downloaded file using GPG:

  • Command

$ gpg --print-md SHA256 apache-cassandra-4.0.1-bin.tar.gz

Result

apache-cassandra-4.0.0-bin.tar.gz: 28757DDE 589F7041 0F9A6A95 C39EE7E6
                                                                    CDE63440 E2B06B91 AE6B2006 14FA364D

Compare the signature with the SHA256 file from the Downloads site:

  • Command

$ curl -L https://downloads.apache.org/cassandra/4.0.1/apache-cassandra-4.0.1-bin.tar.gz.sha256

Result

28757dde589f70410f9a6a95c39ee7e6cde63440e2b06b91ae6b200614fa364d
  1. Unpack the tarball:

$ tar xzvf apache-cassandra-4.0.1-bin.tar.gz

The files will be extracted to the apache-cassandra-4.0.1/ directory. This is the tarball installation location.

  1. Located in the tarball installation location are the directories for the scripts, binaries, utilities, configuration, data and log files:

<tarball_installation>/
  bin/
  conf/
  data/
  doc/
  interface/
  javadoc/
  lib/
  logs/
  pylib/
  tools/

location of the commands to run cassandra, cqlsh, nodetool, and SSTable toolslocation of cassandra.yaml and other configuration fileslocation of the commit logs, hints, and SSTableslocation of system and debug logs <5>location of cassandra-stress tool

For information on how to configure your installation, see Configuring Cassandra.

  1. Start Cassandra:

$ cd apache-cassandra-4.0.1/ && bin/cassandra

This will run Cassandra as the authenticated Linux user.

  1. Monitor the progress of the startup with:

  • Command

$ tail -f logs/system.log

Result
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)...

You can monitor the progress of the startup with:

  • Command

$ tail -f logs/system.log

Result
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)...

For information on how to configure your installation, see Configuring Cassandra.

  1. 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:

$ bin/cqlsh
By Bhavesh