Cassandra is Java program. It requires that the Java Runtime Environment (JRE) 1.6.0_19 or later from Oracle is installed on Linux systems; Java Native Access (JNA) is needed for production installations.
Cassandra is a Java program and requires that the Java Runtime Environment (JRE) 1.6.0_19 or later from Oracle is installed on Linux systems.
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.
Check which version of the JRE your system is using:
java -version
If necessary, 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).
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-6u32-linux-x64-rpm.bin
Extract and run the RPM file. For example:
$ sudo ./jre-6u32-linux-x64-rpm.bin
The RPM installs the JRE into /usr/java/.
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_32/bin/java 20000
Make sure your system is now using the correct JRE. For example:
$ java -version
java version "1.6.0_32"
Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.7-b02, mixed mode)
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_32/bin/java
Enter to keep the current selection[+], or type selection number: 2
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.
Check which version of the JRE your system is using:
java -version
If necessary, download the appropriate version of the JRE, such as jre-6u32-linux-i586.bin, for your system and place it in /opt/java/<32 or 64>.
Make the file executable:
sudo chmod 755 /opt/java/32/jre-6u32-linux-i586.bin
Go to the new folder:
cd /opt/java
Execute the file:
sudo ./jre-6u32-linux-i586.bin
If needed, accept the license terms to continue installing the JRE.
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_32/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.
Set the new JRE as the default:
sudo update-alternatives --set java /opt/java/32/jre1.6.0_32/bin/java
Make sure your system is now using the correct JRE:
$ java -version java version "1.6.0_32" Java(TM) SE Runtime Environment (build 1.6.0_32-b05) Java HotSpot(TM) 64-Bit Server VM (build 20.7-b02, mixed mode)
Java Native Access (JNA) is required for production installations. Installing JNA can improve Cassandra memory usage. When installed and configured, Linux does not swap out the JVM, and thus avoids related performance issues.
$ sudo apt-get install libjna-java
For Ubuntu 10.04 LTS, you need to update to JNA 3.4.
Download the jna.jar from https://github.com/twall/jna.
Remove older versions of the JNA from the /usr/share/java/ directory.
Place the new jna.jar file in /usr/share/java/ directory.
Create a symbolic link to the file:
ln -s /usr/share/java/jna.jar <install_location>/lib
$ yum install jna