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:
1 | sudoadd-apt-repository-yppa:webupd8team/java |
After added the PPA, run commands below one by one to install Java:
1 2 | sudoapt-getupdate sudoaptitude-yinstalloracle-java8-installer |
Verify Installed Java Version:
1 2 3 4 | # java -version javaversion"1.8.0_40" Java(TM)SERuntimeEnvironment(build1.8.0_40-b25) JavaHotSpot(TM)64-BitServerVM(build25.40-b25,mixedmode) |
Step 2. Installing Cassandra.
To install Cassandra, download the binary files from the website, unpack them and move it to your personal folder:
1 2 3 4 | cd~/temp wgethttp://www.us.apache.org/dist/cassandra/2.1.4/apache-cassandra-2.1.4-bin.tar.gz tar-xvzfapache-cassandra-1.2.4-bin.tar.gz mvapache-cassandra-1.2.4~/cassandra |
Next, create data directories for Cassandra:
1 2 3 4 | sudomkdir/var/lib/cassandra sudomkdir/var/log/cassandra sudochown-R$USER:$GROUP/var/lib/cassandra sudochown-R$USER:$GROUP/var/log/cassandra |
Now set Cassandra’s variables by running:
1 2 | exportCASSANDRA_HOME=~/cassandra exportPATH=$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:
1 | sudosh~/cassandra/bin/cassandra |
and then run:
1 | sudosh~/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.