How to Install Redis on Windows Using WSL2

How to Install Redis on Windows Using WSL2

Redis is not officially supported on Windows. However, you can install Redis on Windows by enabling the Windows Subsystem for Linux (WSL2), which lets you run Linux binaries natively on Windows. In this brief tutorial, I’ll guide you step by step to install Redis on Windows. 🚀

Step-by-Step Guide

Enable WSL2:

Open PowerShell as an administrator and run:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Install a Linux Distribution:

Launch the Microsoft Store by running:

start ms-windows-store:

Search for “Ubuntu” and install it.

Open Ubuntu and enter a new Unix username and password when prompted.

Set Up Redis:

Run the following commands in the Ubuntu terminal to install Redis:

curl -fsSL https://packages.redis.io/gpg | sudo gpg –dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg

“`bash
echo “deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main” | sudo tee /etc/apt/sources.list.d/redis.list
“`

“`bash
sudo apt-get update
“`

“`bash
sudo apt-get install redis
“`

Start the Redis Server:

After the installation is complete, start the Redis server with:

sudo service redis-server start

Connect to Redis:

Test that your Redis server is running by connecting with the Redis CLI:

redis-cli
127.0.0.1:6379> ping

Congratulations! You’ve successfully installed Redis on Windows. 🎉 Happy coding! I hope this helps you! 😊

References

Install Redis on Windows

Please follow and like us:
Pin Share