Apache Cassandra 0.8 Documentation

Installing Cassandra Using the Packaged Releases

DataStax provides RedHat/CentOS packaged releases for Cassandra. Debian packages are provided by the Apache Cassandra project. rpm and deb packages are currently supported through the yum and apt package management tools.

Installing Cassandra RPM Packages

DataStax provides yum repositories for CentOS and RedHat Enterprise Linux 5 and 6 and Fedora 12, 13 and 14. These instructions assume that you have the yum package management application installed, and that you have root access on the machine where you are installing.

Installing EPEL

EPEL (Extra Packages for Enterprise Linux) contains dependent packages required by Cassandra, such as jna and jpackage-utils.

  1. Before you begin, make sure you have EPEL installed by checking for a epel.repo and epel-testing.repo in /etc/yum.repos.d.

  2. If these EPEL repositories are not found, install the epel-release package for your OS version. For example:

    # rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
    
  3. You may see a warning about the RPM-GPG-KEY-EPEL key not being found. It is OK to ignore the warning. You can also obtain and install the key from the Fedora Project Web Site if you want to verify the source of the EPEL packages.

Installing the Cassandra RPM Package

  1. Add a yum repository specification for the DataStax repository in /etc/yum.repos.d. For example:

    # vi /etc/yum.repos.d/datastax.repo
    
  2. In this file add the following lines where <OsType> is either EL or Fedora (depending on your operating system):

    [datastax]
    name= DataStax Repo for Apache Cassandra
    baseurl=http://rpm.datastax.com/<OsType>/$releasever
    enabled=1
    gpgcheck=0
    
  3. Install the package using yum.

    # yum install apache-cassandra08
    

Installing Sun JRE on RedHat Systems

DataStax recommends installing the most recently released version of the Oracle Sun Java Runtime Environment (JRE), also referred to as the Java Virtual Machine (JVM). Versions earlier than 1.6.0_19 should not be used.

The rpm packages install the OpenJDK Java Runtime Environment (JRE) instead of the Oracle Sun JRE. After installing using the rpm packaged releases, configure your operating system to use the Oracle Sun JRE instead of OpenJDK.

If you have not already, log in as root. Optionally, you can run the commands using sudo.

  1. Check which version of the java runtime environment your system is using. If your system is using the OpenJDK Runtime Environment, you will need to change it to use the Oracle Sun JRE.

    # java -version
    
  2. Go to the Oracle Java Runtime Environment Download Page, accept the license agreement, and download the Linux x64-RPM Installer or Linuxx86-RPM Installer (depending on your platform).

  3. Go to the directory where you downloaded the JRE package, and change the permissions so the file is executable. For example:

    # cd /tmp
    # chmod a+x jre-6u25-linux-x64-rpm.bin
    
  4. Extract and run the rpm file. For example:

    # ./jre-6u25-linux-x64-rpm.bin
    

    The rpm installs the JRE into /usr/java/.

  5. Configure your system so that it is using the Oracle Sun JRE instead of the OpenJDK JRE. Use the alternatives command to add a symbolic link to the Oracle Sun JRE installation. For example:

    # alternatives --install /usr/bin/java java /usr/java/jre1.6.0_25/bin/java 20000
    
  6. Make sure your system is now using the correct JRE. For example:

    # java -version
      java version "1.6.0_25"
      Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
      Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)
    
  7. If the OpenJDK JRE is still being used, use the alternatives command to switch it. For example:

    # alternatives --config java
    There are 2 programs which provide 'java'.
    
        Selection    Command
    -----------------------------------------------
       1           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
    *+ 2           /usr/java/jre1.6.0_25/bin/java
    
    Enter to keep the current selection[+], or type selection number: 2
    

Installing Cassandra Debian Packages

The Apache Cassandra project provides a debian package repository for Apache Cassandra. These instructions assume that you have the aptitude package management application installed, and that you have root access on the machine where you are installing.

  1. Edit the aptitude repository source list file (/etc/apt/sources.list).

    # vi /etc/apt/sources.list
    
  2. In this file, add the Apache Cassandra 0.8 repository.

    deb http://www.apache.org/dist/cassandra/debian 08x main
    

    (Debian Systems Only) Find the line that describes your source repository for Debian and add contrib non-free to the end of the line. This will allow installation of the Oracle Sun JVM instead of the OpenJDK JVM. For example:

    deb http://some.debian.mirror/debian/ $distro main contrib non-free
    
Save and close the file when you are done adding/editing your sources.
  1. Add the Apache Cassandra repository keys to your aptitude trusted keys.

    # gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D
    # gpg --export --armor F758CE318D77295D | sudo apt-key add -
    # gpg --keyserver pgp.mit.edu --recv-keys 2B5C1B00
    # gpg --export --armor 2B5C1B00 | sudo apt-key add -
    
  2. Install the package.

    # aptitude update
    # aptitude install cassandra
    
  3. Check which version of the Java runtime environment your system is using. If your system is using the OpenJDK Runtime Environment, you will need to change it to use the Oracle Sun JRE.

    # java -version
    

Installing Sun JRE on Ubuntu Systems

DataStax recommends installing the most recently released version of the Oracle Sun Java Runtime Environment (JRE), also referred to as the Java Virtual Machine (JVM). Versions earlier than 1.6.0_19 should not be used.

  1. Edit the aptitude repository source list file (/etc/apt/sources.list).

    # vi /etc/apt/sources.list
    
  2. Add the following repository for your operating system. For example, where <OSType> is lenny, lucid, maverick or squeeze:

    # deb http://archive.canonical.com/ <OSType> partner
    
  3. Install the Sun JRE packages:

    # apt-get update
    # apt-get install sun-java6-jre
    
  4. A license screen will appear and prompt you to accept the license terms. Once you click OK and Yes to accept the license terms, the JRE will finish installing.

  5. Configure your system so that it is using the Oracle Sun JRE instead of the OpenJDK JRE.

    # update-alternatives --config java
    
  6. Make sure your system is now using the correct JRE. For example:

    # java -version
    java version "1.6.0_26"
    Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
    Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
    

About Packaged Installs

The packaged releases install into the following directories. The packaged releases create a cassandra user. When starting Cassandra as a service, the service runs as this user.

  • /var/lib/cassandra (data directories)
  • /var/log/cassandra (log directory)
  • /var/run/cassandra (runtime files)
  • /usr/share/cassandra (environment settings)
  • /usr/share/lib (jar files)
  • /usr/bin (binary files)
  • /usr/sbin
  • /etc/cassandra (configuration files)
  • /etc/init.d (service startup script)
  • /etc/security/limits.d (cassandra user limits)
  • /etc/default

Next Steps

For next steps see Configuring and Starting a Cassandra Cluster.