How to install Cassandra on localhost

This post aims to provide a few easy to follow steps to take the first-time user from installation and to run single node Cassandra. Cassandra is meant to run on a cluster of nodes, but will run equally well on a single machine. This is a handy way of getting familiar with the software while avoiding the complexities of a larger system.

Step 1: Prerequisites and Connecting to the Community

Cassandra requires the most stable version of Java 7 you can deploy, preferably the Oracle/Sun JVM. Cassandra also runs on OpenJDK and the IBM JVM. Because Cassandra requires Java 7, it will NOT run on JRockit.

The best way to ensure you always have up to date information on the project, releases, stability, bugs, and features is to subscribe to the users mailing list and participate in the #cassandra channel on IRC.

Step 2: Download Cassandra

Download links for the latest stable release can always be found on the website (

Users of Debian or Debian-based derivatives can install the latest stable release in package form, see DebianPackaging ( for details.

Users of RPM-based distributions can get packages from Datastax (

If you are interested in building Cassandra from source, please refer to How to Build page (

For more details about misc builds, please refer to Cassandra versions and builds page (

or follow the below steps,

Install using an APT repository.


  • Oracle Java 7 must be installed. To install, see Installing Oracle JRE on Debian or Ubuntu Systems.
  • Root or sudo access.
  • Python 2.6+ (needed if installing OpsCenter).
  • 256MB of memory (only for testing light workloads). If using a virtual machine, be sure to use the recommended memory allocation or more for your operating system.


you can install directly from the ASF repositories:

deb 21x main
deb-src 21x main

You will want to replace 21x by the series you want to use: 20x for the 2.0.x series, 12x for the 1.2.x series, etc… You will not automatically get major version updates unless you change the series, but that is a feature.

If you run apt-get update now, you will see an error similar to this:

GPG error: unstable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY F758CE318D77295D

This simply means you need to add the PUBLIC_KEY. You do that like this:

gpg --keyserver --recv-keys F758CE318D77295D
gpg --export --armor F758CE318D77295D | sudo apt-key add -

Starting with the 0.7.5 debian package, you will also need to add public key 2B5C1B00 using the same commands as above:

gpg --keyserver --recv-keys 2B5C1B00
gpg --export --armor 2B5C1B00 | sudo apt-key add -

You will also need to add public key 0353B12C using the same commands as above:

gpg --keyserver --recv-keys 0353B12C
gpg --export --armor 0353B12C | sudo apt-key add -

Then you may install Cassandra by doing:

sudo apt-get update
sudo apt-get install cassandra

Basic Configuration

The Cassandra configuration files can be found in the conf directory of binary and source distributions. If you have installed Cassandra from a deb or rpm package, the configuration files will be located in /etc/cassandra.

Directories Used by Cassandra

If you’ve installed Cassandra with a deb or rpm package, the directories that Cassandra will use should already be created an have the correct permissions. Otherwise, you will want to check the following config settings from conf/cassandra.yaml: data_file_directories (/var/lib/cassandra/data), commitlog_directory (/var/lib/cassandra/commitlog), and saved_caches_directory (/var/lib/cassandra/saved_caches). Make sure these directories exist and can be written to.

By default, Cassandra will write its logs in /var/log/cassandra/. Make sure this directory exists and is writeable, or change this line in conf/log4j-server.properies:


Note that in Cassandra 2.1+, the logger in use is logback, so change this logging directory in your conf/logback.xml file such as:


JVM-level settings such as heap size can be set in conf/



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s