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 Apache Cassandra in 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 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:
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:
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
Congratulation’s! 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 web site.