How To Install Apache Cassandra on Ubuntu 14.04

Install Apache Cassandra on Ubuntu 14.04

In this tutorial, we will show you how to install Apache Cassandra on Ubuntu 14.04. For those of you who didn’t know, Apache Cassandra is a NoSQL database intended for storing large amounts of data in a decentralized, highly available cluster. NoSQL refers to a database with a data model other than the tabular relations used in relational databases such as MySQL, PostgreSQL, and Microsoft SQL. The Apache Cassandra database is the right choice when you need scalability and high availability without compromising performance.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step-by-step installation of Apache Cassandra in the Ubuntu 14.04 server.

Install Apache Cassandra on Ubuntu 14.04

Step 1. First, Install the Oracle JDK.

Add the webupd8team Java PPA repository in your system:

sudo add-apt-repository -y ppa:webupd8team/java

After added the PPA, run the commands below one by one to install Java:

sudo apt-get update
sudo aptitude -y install oracle-java8-installer

Verify Installed Java Version:

# java -version
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b25)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

Step 2. Installing Cassandra.

To install Cassandra, download the binary files from the website, unpack them, and move it to your personal folder:

cd ~/temp
wget http://www.us.apache.org/dist/cassandra/2.1.4/apache-cassandra-2.1.4-bin.tar.gz
tar -xvzf apache-cassandra-1.2.4-bin.tar.gz
mv apache-cassandra-1.2.4 ~/cassandra

Next, create data directories for Cassandra:

sudo mkdir /var/lib/cassandra
sudo mkdir /var/log/cassandra
sudo chown -R $USER:$GROUP /var/lib/cassandra
sudo chown -R $USER:$GROUP /var/log/cassandra

Now set Cassandra’s variables by running:

export CASSANDRA_HOME=~/cassandra
export PATH=$PATH:$CASSANDRA_HOME/bin

Step 3. Start the Cassandra server.

To run a single-node test cluster of Cassandra, you aren’t going to need to change anything on the cassandra.yaml file. Simply run:

sudo sh ~/cassandra/bin/cassandra

and then run:

sudo sh ~/cassandra/bin/cassandra-cli

Congratulations! You have successfully installed Apache Cassandra. Thanks for using this tutorial for installing Apache Cassandra in Ubuntu 14.04 system. For additional help or useful information, we recommend you to check the official Apache Cassandra website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

Save