Apache Cassandra is an open source NoSQL database. It can store and manage large data sets across many servers. It offers high availability and fault tolerance. This step-by-step guide will show you how to install Apache Cassandra on Ubuntu 17.04 and CentOS 7.
Prerequisites
- A server running Ubuntu 17.04 or CentOS 7
- A user with sudo or root access
- Internet connection
- Basic Linux command-line skills
Installing Apache Cassandra on Ubuntu 17.04
Follow these steps to install Cassandra on an Ubuntu 17.04 server.
1. Update package lists
sudo apt-get update
2. Install Java 8
sudo apt-get install -y openjdk-8-jdk
3. Add the Cassandra repository
echo "deb https://www.apache.org/dist/cassandra/debian 311x main" | sudo tee /etc/apt/sources.list.d/cassandra.list
4. Import the repository key
curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
5. Install Apache Cassandra
sudo apt-get update
sudo apt-get install -y cassandra
6. Enable and start Cassandra
sudo systemctl enable cassandra
sudo systemctl start cassandra
7. Verify the service
sudo systemctl status cassandra
nodetool status
Installing Apache Cassandra on CentOS 7
Use these commands to install Cassandra on a CentOS 7 server.
1. Install Java 8
sudo yum install -y java-1.8.0-openjdk-devel
2. Add the Cassandra repository
cat <<EOF | sudo tee /etc/yum.repos.d/cassandra.repo
[cassandra]
name=Apache Cassandra
baseurl=https://www.apache.org/dist/cassandra/redhat/311x/
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.apache.org/dist/cassandra/KEYS
EOF
3. Install Apache Cassandra
sudo yum install -y cassandra
4. Enable and start Cassandra
sudo systemctl enable cassandra
sudo systemctl start cassandra
5. Verify the service
sudo systemctl status cassandra
nodetool status
Post-Installation Steps
After installation, you can connect to Cassandra with cqlsh:
cqlsh
You can change settings by editing /etc/cassandra/cassandra.yaml. Then restart Cassandra:
sudo systemctl restart cassandra
Conclusion
You have installed Apache Cassandra on Ubuntu 17.04 and CentOS 7. You are now ready to create keyspaces, tables, and manage your data. For more details, visit the Cassandra documentation.
