Create Redis database on Microsoft Windows 10

You can install 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 the below steps to create Redis database on Microsoft Windows 10.

Step 1: Turn on Windows Subsystem for Linux#

In Windows 10, Microsoft replaces 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 one time.

Step 2: Launch Microsoft Windows Store#

start ms-windows-store:

Step 3: Install Redis#

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

Step 4: Restart the Redis server#

sudo service redis-server restart

Step 5: Verify if your Redis server is running#

$ redis-cli
127.0.0.1:6379> set user:1 "Jane"
127.0.0.1:6379> get user:1
"Jane"

Please note: 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

References#

Redis University#

Check out this video if you want to see Redis on Windows 10 Home Edition in action.