This guide contains instructions on how to install Apache Cassandra database on an Ubuntu 22.04 machine.

Prerequisites

  • Operating System : Ubuntu 22.04
  • Access to a Terminal or Shell Console
  • Cassandra requirements
    • Java 8 or later is installed

Installation

01. Open a terminal window

02. Add the Apache repository of Cassandra

$ echo "deb https://debian.cassandra.apache.org 41x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.listdeb https://debian.cassandra.apache.org 41x main

03. Add the Apache Cassandra repository keys

$ curl https://downloads.apache.org/cassandra/KEYS | sudo apt-key add -

04. Update the repository

$ sudo apt update

05. Install Cassandra, enter y when asked to confirm installation.

$ sudo apt install cassandra

06. Optional. Update the configuration to allow it to be accessible publicly. Note that this should be done only in a development environment.

$ sudo nano /etc/cassandra/cassandra.yaml

Set the following configuration as follows

...
rpc_address: <public-ip-address>

...
listen_address: localhost

07. Check the status of Cassandra

$ nodetool status

Uninstallation

01. Remove Apache Cassandra from the package manager. Confirm removal by typing “y” on the prompt.

$ sudo apt remove cassandra

02. Verify if removed successfully by checking with nodetool

$ nodetool status

Additional Commands

Access the cqlsh (CLI for interacting with Cassandra)

$ cqlsh

$ sudo service cassandra start

Start Cassandra service

$ sudo service cassandra start

Stop Cassandra service

$ sudo service cassandra stop
Previous Four Non-Traditional Paths To A Cloud Career (And How To Navigate Them)
Next How To Use Google Cloud To Find And Protect PII