Installing Cassandra on Ubuntu Linux
January 11, 2010
Categories: IT & Administration, Web & Software Development
Tags: Cassandra, NoSQL
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.

4 Responses to “Installing Cassandra on Ubuntu Linux”
By userfriendly on Jan 15, 2010
I’ve tried following this how-to on a machine with Ubuntu 9.10, and despite having JAVA_HOME correctly set (and yes, I’m quite sure of that), the Cassandra installed by the 0.4.2 Debian package kept insisting that it “Cannot locate Java Home”.
Without changing anything else, I went and downloaded the 0.5.0-rc3 binary from the apache incubator website instead which, surprisingly enough, worked just fine – though I do hate bypassing the package manager. <.<
By Mike Limon on Feb 17, 2010
I also got the “Cannot locate Java Home” message. I saw that the inti script had the JAVA_HOME hardcoded to /usr/lib/jvm/java-6-openjdk so I simply made a symlink:
sudo ln -s /usr/lib/jvm/java-6-sun /
/usr/lib/jvm/java-6-openjdk
By Mike Limon on Feb 17, 2010
I also got the “Cannot locate Java Home” message. I saw that the init script had the JAVA_HOME hardcoded to /usr/lib/jvm/java-6-openjdk so I simply made a symlink:
sudo ln -s /usr/lib/jvm/java-6-sun /usr/lib/jvm/java-6-openjdk
By Jauder Ho on Mar 2, 2010
You should consider putting the deb stanzas in a file like /etc/apt/sources.list.d/cassandra.list instead of sources.list
Trying to connect to the instance via the CLI results in an exception though. Investigating.
BTW the 0.5.0 binary is now available via deb.