The Windows Subsystem for Linux (WSL) is a compatibility layer designed to run Linux binary executables natively on Windows 10 and Windows Server 2019. It provides a Linux-compatible kernel interface developed by Microsoft, allowing users to choose a GNU environment for the user-mode binary. With WSL, you can run Linux distributions, manage files, and execute commands and applications, all from a Windows interface. It effectively bridges the gap between Windows and Linux, offering developers and system administrators the flexibility and convenience of using Linux tools in a Windows environment.
Table of Contents
Step 1: Install the Windows Subsystem for Linux
- Open PowerShell as Administrator and run the following command to enable WSL:
- Restart your machine if prompted.
- Once your system reboots, open the Microsoft Store and search for “Ubuntu”. Install the Ubuntu app. You will now have a full Linux terminal environment.
Step 2: Install Java
Apache Cassandra requires Java to run. Here’s how to install OpenJDK 8, which Cassandra supports:
- Open your Ubuntu terminal from the start menu.
- Update your package repository:
sudo apt-get update
- Install OpenJDK 8:
sudo apt-get install openjdk-8-jdk
- Verify the installation by checking the Java version:
Step 3: Install Apache Cassandra
- Add the Apache repository of Cassandra:
echo "deb https://downloads.apache.org/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
- Add the Apache Cassandra repository keys:
curl https://downloads.apache.org/cassandra/KEYS | sudo apt-key add -
- Update the repositories:
sudo apt-get update
- Install Cassandra:
sudo apt-get install cassandra
Step 4: Running Cassandra
- Start the service:
sudo service cassandra start
- Check the status of the service:
sudo service cassandra status
You should now have Cassandra running on your Windows machine via WSL. You can interact with Cassandra through the Cassandra Query Language shell (cqlsh). To start cqlsh, simply type
cqlsh in your terminal.
Please note that this guide was based on the state of Apache Cassandra and Windows as of September 2021, and the steps might vary slightly if things have changed since then.