How to Install Redis on Windows
You can run Redis on Windows 10 using Windows Subsystem for Linux(a.k.a WSL2). WSL2 is a compatibility layer for running Linux binary executables natively on Windows 10 and Windows Server 2019. WSL2 lets developers run a GNU/Linux environment (that includes command-line tools, utilities, and applications) directly on Windows.
Follow these instructions to run a Redis database on Microsoft Windows 10.
Step 1: Turn on Windows Subsystem for Linux
In Windows 10, Microsoft replaced Command Prompt with PowerShell as the default shell. Open PowerShell as Administrator and run this command to enable Windows Subsystem for Linux (WSL):
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Reboot Windows after making the change — note that you only need to do this once.
Step 2: Launch Microsoft Windows Store
start ms-windows-store:
Then search for Ubuntu, or your preferred distribution of Linux, and download the latest version.
Step 3: Install Redis server
Installing Redis is simple and straightforward. The following example works with Ubuntu (you'll need to wait for initialization and create a login upon first use):
sudo apt-add-repository ppa:redislabs/redis
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install redis-server
The sudo
command may or may not be required based on the user configuration of your system.
Step 4: Restart the Redis server
Restart the Redis server as follows:
sudo service redis-server restart
Step 5: Verify if your Redis server is running
Use the redis-cli
command to test connectivity to the Redis database.
$ redis-cli
127.0.0.1:6379> set user:1 "Jane"
127.0.0.1:6379> get user:1
"Jane"
By default, Redis has 0-15 indexes for databases, you can change that number databases NUMBER in redis.conf.
Step 6: Stop the Redis Server
sudo service redis-server stop
Next Steps
Model Redis data in your .NET Applications
Learn how to connect to a Redis database with Redis OM Dotnet
References
Redis University
Check out this video if you want to see Redis on Windows 10 Home Edition in action.