Installing Redis on Windows
What is an In-Memory Database?
An in-memory database is a type of database that primarily relies on the computer's random access memory (RAM) to store data, rather than using disk storage like traditional databases. This design offers several benefits, particularly in terms of performance and speed.
What is Redis?
Redis is an open-source, in-memory database that can be used for caching, message brokering, and real-time analytics. While Redis was designed for Unix-based systems like Linux, it can still be installed and used on Windows with some workarounds.
Installing Redis
1. Run the PowerShell as an administrator
You will not be able to run the code on the next step if you do not have administrator access to your PowerShell.
2. Run the following command to enable Windows Subsystem for Linux (WSL)
Redis doesn't run natively on Windows. The easiest way to get it running is through the WSL, which allows you to run a Linux environment on your Windows machine. WSL 2 is the current default version.
1 |
|
If this is your first time enabling WSL 2, you will be asked to reboot your computer.
3. Run the command below to check the list of available Linux distributions (also known as distros).
1 |
|
4. Install your preferred distro.
Let us go with the Ubuntu 24.04 distro. Upon installation, you will be asked to input your username and password. Take note of them because you will use these credentials when you open up the Ubuntu command line interface (CLI) again.
1 |
|
At this point, there is a chance that you might run into an error if your computer’s Windows Features is not correctly configured. Let us configure it then. In your desktop’s search bar, type in “turn windows features on or off”. This step will open up the Windows Features dialog box. Turn on the following features:
- Virtual Machine Platform
- Windows Hypervisor Platform
You will be asked to reboot your computer if this is your first time enabling the two features above.
5. Open up Ubuntu on Windows by typing ubuntu
in the Windows Search.
6. Using the Ubuntu CLI, type the following to install Redis
1 2 3 4 5 6 |
|
7. Using the Ubuntu CLI, verify that Redis is installed.
Start the Redis server.
1 |
|
Connect to Redis by typing the command.
1 |
|
Test the connection with the ping
command:
1 2 |
|
Common commands for Redis:
To restart the server:
1 |
|
To stop the server:
1 |
|
To check the status of the server:
1 |
|