In this tutorial we’ll learn how to install Apache Cassandra on Ubuntu 16.04. We will also install and configure its prerequisites. Apache Cassandra is an open source distributed database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure. Cassandra offers capabilities that relational databases and other NoSQL databases simply cannot match such as: continuous availability, linear scale performance, operational simplicity and easy data distribution across multiple data centers and cloud availability zones.
I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 16.04 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install Apache Cassandra on Ubuntu 16.04
Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:
apt-get update -y && apt-get upgrade -y
Step 2. Installing Java.
First we need to make sure that Java is installed, so add the repository:
Install Java 8 using the following command:
apt-get update apt-get install oracle-java8-set-default
Confirm your version of Java:
Step 3. Installing Apache Cassandra on Ubuntu 16.04.
To install Apache Cassandra on your server, first you need to add the Cassandra repository. At the moment of writing this tutorial, the latest stable release of Cassandra is 3.11.0:
echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
Next, add the Cassandra repository keys:
curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add - sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-key A278B781FE4B2BDA
Update your list a third time and install Casandra:
apt-get update apt-get install cassandra
Start Cassandra up and configure it to your liking. You’ll most likely want to enable it to start on boot:
systemctl start cassandra systemctl enable cassandra
Cassandra uses a separate command line to be controlled, so we need to make sure to activate that:
[root@myvpsource ~]# cqlsh Connected to Test Cluster at 127.0.0.1:9042. [cqlsh 5.0.1 | Cassandra 3.11.10 | CQL spec 3.4.0 | Native protocol v4] Use HELP for help. cqlsh>
Congratulation’s! You have successfully configured Apache Cassandra on your Ubuntu 16.04 LTS server.