How to Install and Set Up Redis on Windows, Ubuntu, and CentOS
Redis is a database management system that stores data in a key-value format, where each unique key in the database corresponds to a specific value.
To help you integrate Redis into your projects, we have prepared installation guides for three operating systems: Windows, Ubuntu, and CentOS.
After installation, we will configure Redis to make it ready for use.
Installing Redis on Windows Copy link
You will need WSL2 (Windows Subsystem for Linux) to install Redis on Windows. Refer to the WSL2 installation guide on the Microsoft website.
Once the installation and setup of WSL is complete, you will have a Linux system (by default, Ubuntu) running on your machine via WSL.
Now you can proceed to the Installing Redis on Ubuntu chapter and follow the instructions.
Installing Redis on Ubuntu 22.04 Copy link
We will install Redis on Ubuntu using the official repository. This guide is also applicable for Debian installations.
Before installing Redis, update the package lists to ensure you get the latest available version:
sudo apt updateNow, install Redis using the following command:
sudo apt install redis-server -yStart the Redis service and enable it to start automatically on system boot:
sudo systemctl start redis
sudo systemctl enable redisTo check if Redis is running correctly, use:
sudo systemctl status redisIf Redis is active, the output will confirm that the service is running.

And if you’re looking for a reliable, high-performance, and budget-friendly solution for your workflows, Hostman has you covered with Linux VPS Hosting options, including Debian VPS, Ubuntu VPS, and VPS CentOS.
Installing Redis on CentOS 9 Copy link
Now, let's install Redis on CentOS 9.
Run the following command:
sudo dnf install redisStart the Redis service:
sudo systemctl start redisEnable Redis to start automatically on system boot:
sudo systemctl enable redisConfiguring Redis Copy link
Redis setup is done by modifying the configuration files. These files remain the same across all versions. In this guide, we will set up Redis on Ubuntu and connect to it remotely.
To set up basic configuration, we need to modify two key parameters:
- Enable remote connections
- Set up a password
Here are the steps to achieve that.
Step 1: Generate a secure password:
openssl rand 25 | openssl base64 -AExample output:
/37DQhAt5MBq/34Lj24Ppn5LI/UZksAZJQ==Since attackers can attempt up to 150,000 passwords per second, it is crucial to choose a strong password. Copy the generated password and proceed to the configuration file.
Step 2: Open the configuration file:
sudo nano /etc/redis/redis.confModify configuration settings. Find the line:
bind 127.0.0.1 ::1Comment it out by adding # at the beginning:
# bind 127.0.0.1 ::1Find the line:
protected-mode yesChange it to:
protected-mode noIn the Security section, locate the commented-out line:
# requirepass foobaredAdd the following line below it, replacing the value with your generated password:
requirepass /37DQhAt5MBq/34Lj24Ppn5LI/UZksAZJQ==Save and close the file.
Step 3: Restart Redis to apply changes:
sudo systemctl restart redis.serviceStep 4: Verify Redis listening interfaces. Check which network interfaces Redis is listening to:
sudo netstat -lnp | grep redis
Step 5: Connect remotely to your Redis instance. On your local machine, open Terminal or Command Prompt and use redis-cli to connect:
redis-cli -h 192.168.43.37 -p 6379 -a /37DQhAt5MBq/34Lj24Ppn5LI/UZksAZJQ==Step 7: Test the connection by running the ping command:
192.168.43.37:6379> ping
# Output:
PONGSet and retrieve a key-value pair:
192.168.43.37:6379> set key test
# Output:
OK192.168.43.37:6379> get key
# Output:
"test"Redis Database as a Service (DBaaS) Copy link
A Database as a Service (DBaaS) is a cloud-hosted database solution. Using Redis as a DBaaS provides several advantages:
- Reduced maintenance – no need to manually update or manage the database.
- Scalability – easily scale the database as needed.
- Quick setup – ready to use from the start.
- High availability – ensures uninterrupted operation.
With Hostman, you can set up a cloud Redis database in just a few minutes.