Apache Cassandra 1.0 Documentation

Installing Cassandra Using the Packaged Releases

DataStax Community Edition provides two types of packages for Linux:

  • Red Hat Enterprise Linux (RHEL) and CentOS
  • Debian and Ubuntu

RHEL and Debian packages are supported through the yum and apt package management tools.

DataStax also provides a GUI Windows installation package for Microsoft Windows and a tar package for Mac. For more information on Windows and Mac installations, see the DataStax Community Install Instructions.

The pre-requisites and instructions for installing Cassandra on Linux are:

Java Prerequisites

Before installing Cassandra on Linux, Windows, or Mac, ensure that you have the most up-to-date version of Java installed on your machine. To determine if Java is installed on your system, in a terminal window enter:

java -version

DataStax recommends using the most recently released version of Oracle Java SE Runtime Environment (JRE) 6 on all DSE nodes. Versions earlier than 1.6.0_19 should not be used. Java 7 is not recommended. If you need help installing Java, see Installing the JRE on RHEL or CentOS Systems or Installing the JRE on Debian or Ubuntu Systems.

Installing the JRE on RHEL or CentOS Systems

DataStax recommends installing the most recently released version of the Oracle Java SE Runtime Environment (JRE) 6. Versions earlier than 1.6.0_19 should not be used. Java 7 is not recommended.

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

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

    $ java -version
    
  2. Go to Oracle Java SE Downloads, accept the license agreement, and download the Linux x64-RPM Installer or Linux x86-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:

    $ sudo ./jre-6u31-linux-x64-rpm.bin
    

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

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

    $ sudo 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:

    $ sudo 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 the JRE on Debian or Ubuntu Systems

The Oracle Java Runtime Environment (JRE) has been removed from the official software repositories of Ubuntu and only provides a binary (.bin) version. You can get the JRE from the Java SE Downloads.

  1. Download the appropriate version of the JRE, such as jre-6u31-linux-i586.bin, for your system and unpack it directly under /opt/java/<32 or 64>.

  2. Make the file executable:

    sudo chmod 755 /opt/java/32/jre-6u31-linux-i586.bin
    
  3. Go to the new folder:

    cd /opt/java
    
  4. Execute the file:

    sudo ./jre-6u31-linux-i586.bin
    
  5. If needed, accept the license terms to continue installing the JRE.

  6. Tell the system that there’s a new Java version available:

    sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/32/jre1.6.0_31/bin/java" 1
    

Note

If updating from a previous version that was removed manually, execute the above command twice, because you’ll get an error message the first time.

  1. Set the new JRE as the default:

    sudo update-alternatives --set java /opt/java/32/jre1.6.0_31/bin/java
    
  2. Make sure your system is now using the correct JRE:

$ sudo java -version

java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b04, mixed mode)

Installing Cassandra RHEL or CentOS 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 sudo (or root) access on the machine where you are installing.

Note

By downloading community software from DataStax you agree to the terms of the DataStax Community EULA (End User License Agreement) posted on the DataStax web site.

  1. (CentOS 5.x only) Make sure you have EPEL (Extra Packages for Enterprise Linux) installed. EPEL contains dependent packages required by DSE, such as jna and jpackage-utils. For both 32- and 64-bit systems:

    $ sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

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

    $ sudo vi /etc/yum.repos.d/datastax.repo
    
  3. In this file add the following lines for the DataStax repository:

    [datastax]
    name= DataStax Repo for Apache Cassandra
    baseurl=http://rpm.datastax.com/community
    enabled=1
    gpgcheck=0
    
  4. Install the package using yum.

    $ sudo yum install dsc
    

This installs the Cassandra, DataStax Community demos, and OpsCenter packages.

Installing Cassandra Debian Packages

DataStax 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.

Note

By downloading community software from DataStax you agree to the terms of the DataStax Community EULA (End User License Agreement) posted on the DataStax web site.

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

    $ sudo vi /etc/apt/sources.list
    
  2. In this file, add the DataStax Community repository.

    deb http://debian.datastax.com/community stable main
    
  3. (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 allows installation of the Oracle 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 DataStax repository key to your aptitude trusted keys.

    $ curl -L http://debian.datastax.com/debian/repo_key | sudo apt-key add -
    
  2. If needed, install the Python CQL driver.

    sudo apt-get install python-cql=1.0.10-1
    
  3. Install the package.

    $ sudo apt-get update
    $ sudo apt-get install dsc
    

    This installs the Cassandra, DataStax Community demos, and OpsCenter packages. By default, the Debian packages start the Cassandra service automatically.

  4. To stop the service and clear the initial gossip history that gets populated by this initial start:

    $ sudo service cassandra stop
    $ sudo bash -c 'rm /var/lib/cassandra/data/system/*'
    

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/dse-demos (DataStax demo application)
  • /usr/share/cassandra/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.

Powered by Rackspace
Apache, Apache Cassandra, Cassandra, Apache Hadoop, Hadoop and the eye logo are trademarks of the Apache Software Foundation.