How-To: Install Apache Cassandra DB On Ubuntu 22.04

0
211
Vecteezy

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

Prerequisites

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


For enquiries, product placements, sponsorships, and collaborations, connect with us at hello@firegulaman.com. We'd love to hear from you!