How to install Cassandra on Ubuntu

Connect with

How to install Cassandra on UbuntuHow to install Cassandra on Ubuntu. Installing of Apache Cassandra with DataStax on debian based OS either Ubuntu or Linux Mint.

1. Pre-requisites to install Cassandra on Ubuntu

  • Ensure that your platform is supported.
  • Advanced Package Tool is installed.
  • root or sudo access to the install machine.
  • Latest version of Oracle JDK8. if you dont have JDK , install JDK on Ubuntu
  • Python 2.7

The packaged releases create a cassandra user. When starting Cassandra as a service, the service runs as this user. The following utilities are included in a separate package: sstable2json, sstablelevelreset, sstablemetadata, json2sstable, sstablerepairedset, sstablesplit, and token-generator.
Follow following steps and you are done with installation of Apache Cassandra on Ubuntu Linux OS.

2. Step by Step installation for Cassandra on Ubuntu

In a terminal window:

Check which version of Java is installed by running the following command:

 $ java -version


ranjeetjha@jha:~$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

It is recommended to use the latest version of Oracle Java 8 or OpenJDK 8 on all nodes.
Add the DataStax Distribution of Apache Cassandra 3.x repository to the /etc/apt/sources.list.d/cassandra.sources.list

$ echo "deb 3.0 main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list

  $ sudo curl -L | sudo apt-key add -

3. Install the latest package of datastax

 $ sudo apt-get update
 $ sudo apt-get install datastax-ddc

This command automatically installs the Cassandra utilities such as sstablelevelreset, sstablemetadata, sstableofflinerelevel, sstablerepairedset, sstablesplit, token-generator. Each utility provides usage/help information; type help after entering the command.
Debian packages start the Cassandra service automatically, you do not need to start the service. Now cassandra service is running you can check by typing following command.

3.1 To check status of Cassndra service

  $ service cassandra status

3.2 To start cassandra service

  $ service cassandra start

3.3 To stop cassandra service

  $ service cassandra stop

Verify that DataStax Distribution of Apache Cassandra is running:

 $ nodetool status
   Datacenter: datacenter1
   |/ State=Normal/Leaving/Joining/Moving
   --  Address             Load       Tokens  Owns    Host ID                               Rack
   UN KB   47.66 KB   256     100%    aaa1b7c1-6049-4a08-ad3e-3697a0e30e10  rack1

Because the Debian packages start the Cassandra service automatically, you must stop the server and clear the data:

Doing this removes the default cluster_name (Test Cluster) from the system table. All nodes must use the same cluster name.

$ sudo service cassandra stop
$ sudo rm -rf /var/lib/cassandra/data/system/*

4. Reference


I hope you enjoyed the installation of Apache Cassandra on your Ubuntu Linux OS. Happy Learning! 🙂

Connect with

1 thought on “How to install Cassandra on Ubuntu”

  1. That is a very good tip especially to those new to the blogosphere.
    Short but very precise info… Thanks for sharing this one.

    A must read article!

Leave a Comment

Your email address will not be published. Required fields are marked *