How To Install Cassandra Ubuntu 14.04

Cassandra, or Apache Cassandra, is a highly scalable open source NoSQL database system, achieving great performance on multi-node setups.

Installing the Oracle Java Virtual Machine

Cassandra requires that the Oracle Java SE Runtime Environment (JRE) be installed. So, in this step, you’ll install and verify that it’s the default JRE.

To make the Oracle JRE package available, you’ll have to add a Personal Package Archives (PPA) using this command:

sudo add-apt-repository ppa:webupd8team/java

Update the package database:

sudo apt-get update

Then install the Oracle JRE. Installing this particular package not only installs it but also makes it the default JRE. When prompted, accept the license agreement:

sudo apt-get install oracle-java8-set-default

After installing it, verify that it’s now the default JRE:

java -version

output similar to the following:

java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

At TekSlate, we offer resources that help you in learning various IT courses. We avail both written material and demo 
video tutorials. To gain in-depth knowledge and be on par with  practical experience, then explore Cassandra Training.

Installing Cassandra

We’ll install Cassandra using packages from the official Apache Software Foundation repositories, so start by adding the repo so that the packages are available to your system. Note that Cassandra 2.2.2 is the latest version at the time of this publication. Change the 22x to match the latest version. For example, use23x if Cassandra 2.3 is the latest version:

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

The add the repo’s source:

echo "deb-src 22x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list

To avoid package signature warnings during package updates, we need to add three public keys from the Apache Software Foundation associated with the package repositories.

Add the first one using this pair of commands, which must be run one after the other:

gpg --keyserver --recv-keys F758CE318D77295D
gpg --export --armor F758CE318D77295D | sudo apt-key add -

Then add the second key:

gpg --keyserver --recv-keys 2B5C1B00
gpg --export --armor 2B5C1B00 | sudo apt-key add -

Then add the third:

gpg --keyserver --recv-keys 0353B12C
gpg --export --armor 0353B12C | sudo apt-key add -

Update the package database once again:

sudo apt-get update

Finally, install Cassandra:

sudo apt-get install cassandra

Learn more about Cassandra Interview Questions in this blog post.

Troubleshooting and Starting Cassandra

Cassandra should have been started automatically at this point. However, because of a bug, it does not. To confirm that it’s not running, type:

sudo service cassandra status

If it is not running, the following output will be displayed:

* could not access pidfile for Cassandra

This is a well-known issue with the latest versions of Cassandra on Ubuntu. We’ll try a few fixes. First, start by editing its init script. The parameter we’re going to modify is on line 60 of that script, so open it using:

sudo nano +60 /etc/init.d/cassandra

That line should read:


Change it to:


Close and save the file, then reboot the server:

sudo reboot


sudo shutdown -r now

After logging back in, Cassandra should now be running. Verify:

sudo service cassandra status

If you are successful, you will see:

* Cassandra is running

Connecting to the Cluster

If you were able to successfully start Cassandra, check the status of the cluster:

sudo nodetool status

In the output, UN means it’s Up and Normal:

Datacenter: datacenter1
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens       Owns    Host ID                               Rack
UN  142.02 KB  256          ?       2053956d-7461-41e6-8dd2-0af59436f736  rack1Note: Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless

Then connect to it using its interactive command line interface cqlsh.


You will see it connect:

Connected to Test Cluster at
[cqlsh 5.0.1 | Cassandra 2.2.2 | CQL spec 3.3.1 | Native protocol v4]
Use HELP for help.

Type exit to quit:

cqlsh> exit

For an Indepth knowledge on Cassandra, click on below

Review Date
Reviewed Item
How To Install Cassandra Ubuntu 14.04
Author Rating

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at, we will update the article in 24 hours.”

0 Responses on How To Install Cassandra Ubuntu 14.04"

    Leave a Message

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


    Please leave a message and we'll get back to you soon.
    Three + 6