Installing Apache Cassandra 3.x on Debian-based systems
Install using APT repositories on Debian and Ubuntu.
The latest version of Cassandra 3.x is 3.11.5.
Use these steps to install Apache Cassandra™ using APT repositories on Debian and Ubuntu Linux.
Prerequisites
- APT (Advanced Package Tool) is installed.
- Root or sudo access to the install machine.
- Python 2.7 if using cqlsh.
- DataStax recommends using the latest version of either OpenJDK 8 or Oracle Java Platform, Standard Edition 8 (JDK).
The packaged releases create a cassandra
user. When starting Cassandra as a service, the service runs as this user.
Procedure
In a terminal window:
-
Check which version of Java is installed by running the following
command:
java -version
DataStax recommends using the latest version of Java 8 on all nodes. See Installing the JDK and Python 2.7. -
Add the Apache Cassandra repository to the
/etc/apt/sources.list.d/cassandra.sources.list:
echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
-
If using Oracle Java on Debian systems:
-
Add the Apache Cassandra repository key to your aptitude trusted keys.
curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
-
Install the packages:
Note: Apache Cassandra only provides the latest patch version. If you need to install an earlier patch version, contact DataStax Support.
sudo apt-get update
If you encounter this error:GPG error: http://dl.bintray.com/apache/cassandra 311x InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A278B781FE4B2BDA
-
Install Cassandra:
sudo apt-get install cassandra
-
Install the optional tools:
sudo apt-get install cassandra-tools=3.11.x.x ## Optional utilities
-
Because the Debian packages start the Cassandra service automatically, you must
stop the server and clear the data:
Doing this removes the default cluster_name (Test Cluster) from the system table. All nodes must use the same cluster name.
sudo service cassandra stop
sudo rm -rf /var/lib/cassandra/*
Cassandra is ready for configuration. - Optional: To change the location of the default directories (/var/lib/cassandra), see the following in /etc/cassandra/conf/cassandra.yaml:
- Optional:
To change the location of the log files
(/var/log/cassandra), replace the path to the log
directory in /usr/sbin/cassandra:
if [ -z "$CASSANDRA_LOG_DIR" ]; then CASSANDRA_LOG_DIR=/var/log/cassandra fi