Redis runs natively on Linux-based operating systems but can be installed and run on Windows 10/11 using Windows Subsystem for Linux (WSL). In this blog, we will guide you through the steps to install Redis on Windows using WSL.
What is Redis?
Redis full form is Remote Directory Server. Redis is a popular NO-SQL in-memory data structure store that is often used as a database, cache, and message broker.
It is widely used by developers and system administrators to improve the performance and scalability of their applications.
What is WSL?
WSL (Windows Subsystem for Linux) is a compatibility layer for running Linux binary executables natively on Windows.
It provides a lightweight Linux environment that runs on top of the Windows operating system, enabling users to run Linux command-line tools and applications directly on Windows without the need for a virtual machine or dual-boot setup.
Install Redis on Windows 10/11 Using WSL
Now that we have a brief idea of what Redis and WSL are, let’s see how we can install Redis on Windows using WSL.
Step 1: Turn on Windows Subsystem for Linux
Before we can install Redis on Windows, we need to enable the Windows Subsystem for Linux (WSL).
WSL is a compatibility layer that enables running Linux binary executables natively on Windows 11 and Windows Server 2019.
Open PowerShell as Administrator and run the following command to enable WSL:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
After running this command, you need to reboot your system. Note that this step only needs to be done once.
Step 2: Launch Microsoft Windows Store
Once the WSL is enabled, launch the Microsoft Windows Store and search for your preferred Linux distribution. In this example, we will use Ubuntu.
Download the latest version of Ubuntu and wait for it to finish the installation.
Step 3: Install the Redis server on Windows WSL
Installing Redis on Ubuntu is simple and straightforward.
Open a terminal window and run the following commands:
sudo apt-add-repository ppa:redislabs/redis sudo apt-get update sudo apt-get upgrade sudo apt-get install redis-server
Note that the
sudo command may or may not be required based on the user configuration of your system.
Step 4: Restart the Redis server on Windows WSL
After installing Redis, you need to restart the Redis server. Run the following command to restart the Redis server:
sudo service redis-server restart
Step 5: Verify if your Redis server is running on Windows WSL
You can test the connectivity to the Redis database using the
redis-cli command. Run the following command to launch the Redis command-line interface:
After launching the Redis CLI, run the following commands to set a key-value pair and retrieve its value:
127.0.0.1:6379> set user:1 "Jane" 127.0.0.1:6379> get user:1 "Jane"
Note that by default, Redis has 0-15 indexes for databases, and you can change that number in the
redis.conf configuration file.
Step 6: Stop the Redis server
If you want to stop the Redis server, run the following command:
sudo service redis-server stop
Installed Redis on Windows – What’s Next?
Congratulations, you have successfully installed Redis on Windows using WSL! Now that you have Redis up and running, you can start exploring its features and capabilities.
Redis is a powerful in-memory data structure store that can be used for various use cases, such as caching, session management, real-time analytics, and more.
To get started with Redis, we recommend exploring our blog to learn about:
By familiarizing yourself with these concepts, you’ll be well on your way to becoming a Redis master and unlocking the full potential of Redis.
In conclusion, installing Redis on Windows 10 using Windows Subsystem for Linux (WSL) is a straightforward process. By following the steps outlined in this blog post, you can get Redis up and running on your Windows machine in no time. WSL provides a robust and reliable Linux environment that allows developers to use Redis on Windows without any significant compatibility issues.
With Redis running on your Windows machine, you can take advantage of its high performance and scalability features to build powerful and reliable applications. By using WSL, you can harness the power of Redis and build applications that take full advantage of its capabilities, while still working in the Windows environment you’re accustomed to.
- Redis Labs Official Installation Guide: https://developer.redis.com/create/windows/