<\/span><\/h2>\r\n\r\n\r\n\r\nFirst, log in to your Ubuntu 20.04 server via SSH as the root user:<\/p>\r\n\r\n\r\n\r\n
ssh root@IP_Address -p Port_number<\/pre>\r\n\r\n\r\n\r\nYou will need to replace ‘IP_Address’ and ‘Port_number’ with your server’s respective IP address and SSH port number. Additionally, replace ‘root’ with the username of the admin account if necessary.<\/p>\r\n\r\n\r\n\r\n
Before starting, you have to make sure that all Ubuntu OS packages installed on the server are up to date. You can do this by running the following commands:<\/p>\r\n\r\n\r\n\r\n
apt-get update -y\r\napt-get upgrade -y<\/pre>\r\n\r\n\r\n\r\n<\/span>Step 2: Install Java<\/span><\/h2>\r\n\r\n\r\n\r\nApache Cassandra requires Java version 8 to be installed in your system. You can install it using the following command:<\/p>\r\n\r\n\r\n\r\n
apt-get install openjdk-8-jdk -y<\/pre>\r\n\r\n\r\n\r\nOnce the installation is completed, verify the installed version of Java with the following command:<\/p>\r\n\r\n\r\n\r\n
java -version<\/pre>\r\n\r\n\r\n\r\nYou should get the following output:<\/p>\r\n\r\n\r\n\r\n
openjdk version \"1.8.0_275\"\r\nOpenJDK Runtime Environment (build 1.8.0_275-8u275-b01-0ubuntu1~20.04-b01)\r\nOpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode)\r\n<\/pre>\r\n\r\n\r\n\r\n<\/span>Step 3: Install Apache Cassandra<\/span><\/h2>\r\n\r\n\r\n\r\nBy default, the Apache Cassandra is not available in the Ubuntu default repository. So you will need to add the Cassandra repository to your system.<\/p>\r\n\r\n\r\n\r\n
First, install the required dependencies with the following command:<\/p>\r\n\r\n\r\n\r\n
apt-get install apt-transport-https gnupg2 -y<\/pre>\r\n\r\n\r\n\r\nNext, download and add the GPG key with the following command:<\/p>\r\n\r\n\r\n\r\n
wget -q -O - https:\/\/www.apache.org\/dist\/cassandra\/KEYS | apt-key add -<\/pre>\r\n\r\n\r\n\r\nNext, add the Cassandra repository to the APT with the following command:<\/p>\r\n\r\n\r\n\r\n
sh -c 'echo \"deb http:\/\/www.apache.org\/dist\/cassandra\/debian 311x main\" > \/etc\/apt\/sources.list.d\/cassandra.list'<\/pre>\r\n\r\n\r\n\r\nNext, update the repository cache and install the Apache Cassandra with the following command:<\/p>\r\n\r\n\r\n\r\n
apt-get update -y\r\napt-get install cassandra -y<\/pre>\r\n\r\n\r\n\r\nOnce the Cassandra has been installed, verify the status of the Cassandra with the following command:<\/p>\r\n\r\n\r\n\r\n
systemctl status cassandra<\/pre>\r\n\r\n\r\n\r\nYou should get the following output:<\/p>\r\n\r\n\r\n\r\n
\u25cf cassandra.service - LSB: distributed storage system for structured data\r\n Loaded: loaded (\/etc\/init.d\/cassandra; generated)\r\n Active: active (running) since Mon 2020-12-21 05:15:39 UTC; 4s ago\r\n Docs: man:systemd-sysv-generator(8)\r\n Tasks: 29 (limit: 2353)\r\n Memory: 1.1G\r\n CGroup: \/system.slice\/cassandra.service\r\n \u2514\u250012029 java -Xloggc:\/var\/log\/cassandra\/gc.log -ea -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -XX:+HeapDumpOnOutOfMemor>\r\n\r\nDec 21 05:15:39 ubuntu2004 systemd[1]: Starting LSB: distributed storage system for structured data...\r\nDec 21 05:15:39 ubuntu2004 systemd[1]: Started LSB: distributed storage system for structured data.\r\n<\/pre>\r\n\r\n\r\n\r\nYou can also verify the Cassandra using the nodetool command-line utility:<\/p>\r\n\r\n\r\n\r\n
nodetool status<\/pre>\r\n\r\n\r\n\r\nYou should get the following output:<\/p>\r\n\r\n\r\n\r\n
Datacenter: datacenter1\r\n=======================\r\nStatus=Up\/Down\r\n|\/ State=Normal\/Leaving\/Joining\/Moving\r\n-- Address Load Tokens Owns (effective) Host ID Rack\r\nUN 127.0.0.1 70.71 KiB 256 100.0% ba73f88d-9d00-49b7-aa50-baedb4ee0558 rack1\r\n<\/pre>\r\n\r\n\r\n\r\n