1. Redis does not officially provide a native installation package for Windows. See Figure 1.

2. Reference: This project is no longer actively maintained. If you are looking for a Windows version of Redis, you may want to check out Memurai. Please note that Microsoft does not officially endorse this product in any way. I decided to use Memurai. See Figure 2.

3. After installing Memurai-Developer-v4.1.2.msi, restart the computer for the environment variables to take effect.
4. Ultimately, it had no effect, and C:\Program Files\Memurai did not exist. After executing: C:\>msiexec /quiet /i Memurai.msi, there was still no effect. I finally decided to give up.
PS C:\> msiexec /quiet /i Memurai.msi
PS C:\>
5. I checked and found that port 6379 was occupied again.
PS C:\> netstat -ano | findstr :6379
TCP 192.168.89.29:63792 3.231.104.211:443 ESTABLISHED 4920
6. Reference: Install or enable WSL2 . See Figure 3.

PS C:\> wsl --install
Installing: Virtual Machine Platform
Virtual Machine Platform has been installed.
Installing: Windows Subsystem for Linux
Windows Subsystem for Linux has been installed.
Installing: Windows Subsystem for Linux
Windows Subsystem for Linux has been installed.
Installing: Ubuntu
Ubuntu has been installed.
The requested operation is successful. Changes will not take effect until the system is restarted.
PS C:\>
7. Install Redis. Enter Ubuntu and install the latest stable version of Redis from the official APT repository packages.redis.io. Add the repository to the apt index, update it, and then install. See Figure 4.

root@DESKTOP-H4MGQIU:~# curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
root@DESKTOP-H4MGQIU:~# 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
deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb jammy main
root@DESKTOP-H4MGQIU:~# sudo apt-get update
Get:1 https://packages.redis.io/deb jammy InRelease [3821 B]
Get:2 https://packages.redis.io/deb jammy/main all Packages [4502 B]
Get:3 https://packages.redis.io/deb jammy/main amd64 Packages [21.2 kB]
Hit:4 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:5 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Get:7 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1673 kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [127 kB]
Get:9 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [14.1 MB]
Get:10 http://security.ubuntu.com/ubuntu jammy-security/main Translation-en [279 kB]
Get:11 http://security.ubuntu.com/ubuntu jammy-security/main amd64 c-n-f Metadata [13.0 kB]
Get:12 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [2171 kB]
Get:13 http://security.ubuntu.com/ubuntu jammy-security/restricted Translation-en [372 kB]
Get:14 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 c-n-f Metadata [572 B]
Get:15 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [886 kB]
Get:16 http://security.ubuntu.com/ubuntu jammy-security/universe Translation-en [173 kB]
Get:17 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 c-n-f Metadata [18.9 kB]
Get:18 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [37.2 kB]
Get:19 http://security.ubuntu.com/ubuntu jammy-security/multiverse Translation-en [7588 B]
Get:20 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 c-n-f Metadata [228 B]
Get:21 http://archive.ubuntu.com/ubuntu jammy/universe Translation-en [5652 kB]
Get:22 http://archive.ubuntu.com/ubuntu jammy/universe amd64 c-n-f Metadata [286 kB]
Get:23 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [217 kB]
Get:24 http://archive.ubuntu.com/ubuntu jammy/multiverse Translation-en [112 kB]
Get:25 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 c-n-f Metadata [8372 B]
Get:26 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1888 kB]
Get:27 http://archive.ubuntu.com/ubuntu jammy-updates/main Translation-en [337 kB]
Get:28 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 c-n-f Metadata [17.7 kB]
Get:29 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [2238 kB]
Get:30 http://archive.ubuntu.com/ubuntu jammy-updates/restricted Translation-en [384 kB]
Get:31 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 c-n-f Metadata [604 B]
Get:32 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1108 kB]
Get:33 http://archive.ubuntu.com/ubuntu jammy-updates/universe Translation-en [258 kB]
Get:34 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 c-n-f Metadata [25.4 kB]
Get:35 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [43.3 kB]
Get:36 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse Translation-en [10.8 kB]
Get:37 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 c-n-f Metadata [444 B]
Get:38 http://archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [67.1 kB]
Get:39 http://archive.ubuntu.com/ubuntu jammy-backports/main Translation-en [11.0 kB]
Get:40 http://archive.ubuntu.com/ubuntu jammy-backports/main amd64 c-n-f Metadata [388 B]
Get:41 http://archive.ubuntu.com/ubuntu jammy-backports/restricted amd64 c-n-f Metadata [116 B]
Get:42 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [28.8 kB]
Get:43 http://archive.ubuntu.com/ubuntu jammy-backports/universe Translation-en [16.5 kB]
Get:44 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 c-n-f Metadata [672 B]
Get:45 http://archive.ubuntu.com/ubuntu jammy-backports/multiverse amd64 c-n-f Metadata [116 B]
Fetched 32.8 MB in 19s (1686 kB/s)
Reading package lists... Done
root@DESKTOP-H4MGQIU:~# sudo apt-get install redis
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
redis-server redis-tools
Suggested packages:
ruby-redis
The following NEW packages will be installed:
redis redis-server redis-tools
0 upgraded, 3 newly installed, 0 to remove and 112 not upgraded.
Need to get 1726 kB of archives.
After this operation, 9790 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://packages.redis.io/deb jammy/main amd64 redis-tools amd64 6:7.2.5-1rl1~jammy1 [1610 kB]
Get:2 https://packages.redis.io/deb jammy/main amd64 redis-server amd64 6:7.2.5-1rl1~jammy1 [82.3 kB]
Get:3 https://packages.redis.io/deb jammy/main amd64 redis all 6:7.2.5-1rl1~jammy1 [33.9 kB]
Fetched 1726 kB in 4s (493 kB/s)
Selecting previously unselected package redis-tools.
(Reading database ... 24208 files and directories currently installed.)
Preparing to unpack .../redis-tools_6%3a7.2.5-1rl1~jammy1_amd64.deb ...
Unpacking redis-tools (6:7.2.5-1rl1~jammy1) ...
Selecting previously unselected package redis-server.
Preparing to unpack .../redis-server_6%3a7.2.5-1rl1~jammy1_amd64.deb ...
Unpacking redis-server (6:7.2.5-1rl1~jammy1) ...
Selecting previously unselected package redis.
Preparing to unpack .../redis_6%3a7.2.5-1rl1~jammy1_all.deb ...
Unpacking redis (6:7.2.5-1rl1~jammy1) ...
Setting up redis-tools (6:7.2.5-1rl1~jammy1) ...
Setting up redis-server (6:7.2.5-1rl1~jammy1) ...
Setting up redis (6:7.2.5-1rl1~jammy1) ...
Processing triggers for man-db (2.10.2-1) ...
root@DESKTOP-H4MGQIU:~#
8. Edit the Redis configuration file /etc/redis/redis.conf. Go to the bind option, which is usually bound to 127.0.0.1 by default, and change it to bind to all interfaces 0.0.0.0. See Figure 5.

9. Save and close the file. Then restart the Redis service for the changes to take effect:
sudo service redis-server restart
10. Run ip addr in the WSL terminal to find the WSL IP address.
root@DESKTOP-H4MGQIU:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:7b:2d:f2 brd ff:ff:ff:ff:ff:ff
inet 172.24.155.141/20 brd 172.24.159.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::215:5dff:fe7b:2df2/64 scope link
valid_lft forever preferred_lft forever
root@DESKTOP-H4MGQIU:~#
11. Set an authentication password for the default user; otherwise, you may not be able to access Redis from the external Windows host. Then restart the service. See Figure 6.

root@DESKTOP-H4MGQIU:~# vi /etc/redis/redis.conf
root@DESKTOP-H4MGQIU:~# sudo service redis-server restart
root@DESKTOP-H4MGQIU:~#
12. Connect to Redis in WSL from Windows. The connection is successful. See Figure 7.

