Installing Cassandra on Different Operating Systems (Windows, Linux, Docker)
Windows Installation of Cassandra
1. Download the Cassandra Installer
Download the Cassandra installer from the official Apache Cassandra website.
2. Install Cassandra
Use the following commands to install Cassandra:
bash
sudo apt-get update
sudo apt-get install jdk-8u292-latest-jre openjdk-8-jdk
wget https://downloads.apache.org/cassandra/7.1.4/cassandra-7.1.4-win64.zip
unzip cassandra-7.1.4-win64.zip
3. Configure Cassandra
Open the cassandra\conf\rpc.yaml file and modify the following parameters:
listen_address: '127.0.0.1'
port: 9042
rpc_address: '127.0.0.1'
rpc_port: 9142
4. Start Cassandra
Use the following command to start Cassandra:
cqlsh
Linux Installation of Cassandra
1. Install Dependencies
Use the following commands to install dependencies:
sudo apt-get update
sudo apt-get install jdk-8u292-latest-jre openjdk-8-jdk build-essential libcurl4-openssl-dev libssl-dev
2. Download Cassandra Source Code
Download the Cassandra source code from the official Apache Cassandra website.
3. Build Cassandra
Use the following commands to build Cassandra:
./build.sh
4. Install Cassandra
Use the following commands to install Cassandra:
sudo cp build Target/cassandra-7.1.4 /usr/local/
sudo chown -R Cassandra:Cassandra /usr/local/cassandra
sudo update-rc.d cassandra defaults
5. Configure Cassandra
Open the /etc/cassandra/cassandra.yml file and modify the following parameters:
listen_address: '127.0.0.1'
port: 9042
rpc_address: '127.0.0.1'
rpc_port: 9142
6. Start Cassandra
Use the following command to start Cassandra:
sudo service cassandra start
Docker Installation of Cassandra
1. Install Docker
If you have not yet installed Docker, download and install it.
2. Install the Cassandra Docker Image
Use the following command to install the Cassandra Docker image:
docker pull cassandra:latest
3. Start Cassandra
Use the following command to start Cassandra:
docker run -d --name cassandra -p 9042:9042 cassandra:latest
4. Configure Cassandra
Open the /etc/cassandra/cassandra.yml file and modify the following parameters:
listen_address: '0.0.0.0'
port: 9042
rpc_address: '127.0.0.1'
rpc_port: 9142
5. Start Cassandra
Use the following command to start Cassandra:
docker run -d --name cassandra -p 9042:9042 cassandra:latest