Installing Cassandra on Ubuntu Linux

Cassandra is a highly scalable, eventually consistent, distributed, structured key-value store. It’s an alternative to SQL if you don’t need relational data structures. The best part is it’s super fast, and distributed. The worst part is there’s not much documentation or community, at least compared to MySQL. So, I’m doing my small part to contribute to Cassandra. Here’s how I installed Cassandra on Ubuntu 8.04.2 LTS (hardy), but these directions should work on pretty much any Linux distro.

1. First upgrade your software as is with the following two commands (just for good measure):

sudo apt-get update
sudo apt-get upgrade

2. Now, open up your Debian package sources list with Nano for editing using the following command:

sudo nano /etc/apt/sources.list

3. Next, add the following sources to your /etc/apt/sources.list file.

deb http://www.apache.org/dist/incubator/cassandra/debian unstable main
deb-src http://www.apache.org/dist/incubator/cassandra/debian unstable main

After you add these two lines, press cntrl+X to close Nano. It’ll ask “Save modified buffer?” Press Y. Press Enter when Nano asks “File Name to Write.”

4. Run the update to install Casandra with this command:

sudo apt-get update

5. ERROR! At this point you receive an error similar to this:

W: GPG error: http://www.apache.org unstable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F758CE318D77295D

6. Use the following three commands to ignore the signature error, and continue installing:

NOTE: You must replace the key value ‘F758CE318D77295D’ with the key value you received in your error message.

gpg --keyserver wwwkeys.eu.pgp.net --recv-keys F758CE318D77295D
sudo apt-key add ~/.gnupg/pubring.gpg
sudo apt-get update

7. Install Cassandra:

sudo apt-get install cassandra

8. Next you need to change Cassandra’s default port number from 8080 to something else, because the 8080 port typically conflicts with SSH terminal connections. Use Nano to open up the Cassandra configuration file using the following command:

sudo nano /usr/share/cassandra/cassandra.in.sh

9. Then change the port number 8080 on the following line to 10036, and save the file:

-Dcom.sun.management.jmxremote.port=10036 \

10. Start Cassandra with the command:

/etc/init.d/cassandra start

Once you have Cassandra running, test it with Cassandra’s command line tool CLI. Use the example found on the Cassandra Wiki.