CentOS 6 Installing Datastax Apache Cassandra

I recently setup a Cassandra environment for a customer, the easiest approach was to utilize the DataStax Yum repository which is detailed below. As detailed previously there is a compatability issue with the OpenJDK default in CentOS so first follow my previous post on installing the Oracle JDK.


  • As root create /etc/yum.repos.d/datastax.repo:
    name= DataStax Repo for Apache Cassandra
  • To install Cassandra, for Apache Cassandra 1.2.x:
    sudo yum install cassandra12
  • Install a copy of JNA jar just for Cassandra
    Note: JNA from base repo is 3.2.4 while Cassandra requires 3.2.7+
    cd /usr/share/cassandra/lib
    sudo wget
    sudo chown cassandra:cassandra jna-3.5.1.jar
    sudo chown 755 jna-3.5.1.jar
  • Fix permissions
    sudo chown -R cassandra:cassandra /var/lib/cassandra
    sudo chown -R cassandra:cassandra /var/log/cassandra


  • Create /etc/profile.d/
    export CASSANDRA_HOME=/usr/share/cassandra
  • Load into current session:
    source /etc/profile.d/
  • Edit the following settings in /etc/cassandra/conf/cassandra.yaml:
    cluster_name: ''
    - seeds: ""

    Note: for more details about configuring and optimizing a multi-node cluster, see sources.
  • Open ports
    7199 for JMX
    9160 for Cassandra Thrift
    7000 for Cassandra Gossip
  • Start cassandra:
    sudo service cassandra start
  • Start cassandra on boot:
    sudo chkconfig cassandra on

CentOS 6 Installing Oracle JDK

Having recently setup a Cassandra environment for a customer I found it would crash with a segmentation fault. I discovered this was due to the OpenJDK that is bundled with CentOS – as a workaround I installed the Sun Oracle JDK using the steps below:

  • Download the appropriate file (e.g jdk-7u45-linux-x64.rpm) JDK from Oracle website. Exact as necessary and install JDK rpm:
    sudo yum localinstall jdk-.rpm
  • Add java as alternative for /usr/bin/java:
    sudo alternatives --install /usr/bin/java java /usr/java/latest/bin/java <priority>
    Note: Default priority of open-jdk is 16000. A higher priority must be selected.
  • To add JAVA_HOME to environment variables create /etc/profile.d/ containing the following:
    export JAVA_HOME=<java_home>
    Note: If Oracle JDK is installed is /usr/java/latest
    Load into current session:
    source /etc/profile.d/
    echo $JAVA_HOME
  • Verify installation
    java -version
    java version "1.7.0_25"
    Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
    Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)