August 24th, 2013

This posting originated at and can be found here. 


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

In this tutorial, you’ll learn how to install Cassandra, the Oracle Java VM, which is highly recommended for Cassandra, and how to run your first test single-node cluster.

Installing the Oracle Java VM

Make a temporary folder on your home directory to install Java.

The Cassandra documentation highly recommends the Oracle Java VM 6, so you’ll have to download it from Oracle’s website. It requires a free account, which you can register here. After you’ve created your account, download either the 32-bit or the 64-bit (recommended) version of Java 6. Once you’ve downloaded it, transfer it to your VPS using FTP or any other tool. You can find a tutorial on how to setup an FTP server here.

Now make the file you’ve downloaded executable and then execute it by running:

You should now move it to the proper folder:

To make it the default Java VM on your VPS, add these lines to the /etc/profile file:

by scrolling down after running:

and pasting it at the end of the file, like so:

 How /etc/profile should look

After you’ve done this, press CTRL+O to save and CTRL+X to exit. Next, run the following lines so when the command “java” is called, it’s done so by the right VM.

You should now reboot your VPS so everything is updated:

When establishing a SSH connection again, test to see if everything is set properly by running:

If everything went OK, you should see this:

 If Java was installed properly, you should see this

Installing Cassandra

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

Next, make sure that the folders Cassandra accesses, such as the log folder, exists and that Cassandra has the right to write on it:

Now set Cassandra’s variables by running:

You’re going to need to configure Cassandra’s per-thread stack size to a larger one than default. Do so by running:

and scrolling down to the line that says:

and changing it to:

like the image below:

 A larger stack size on the config file

Simply press CTRL+O to save and CTRL+X to exit.

Running Cassandra

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:

and then run:

and if it says “Connected to: ‘Test Cluster'” as it does on the image below, you are now running your single-node cluster.

Cassandra running for the first time