Learn how to install Redis on Ubuntu 26.04 using the official Redis repository. Follow this step by step guide to install the latest stable Redis version, verify the installation, manage the Redis service, and configure your server.
Redis is a fast in memory database that is commonly used for caching, session storage, message queues, and real time applications. It is lightweight, easy to manage, and can significantly improve the performance of web applications.
Prerequisites
Before you begin, make sure you have:
-
Ubuntu 26.04 installed dedicated server.
-
A user account with sudo privileges
-
Internet access
Let's start learning how to install Redis on Ubuntu 26.04 step-by-step
Step 1: Update Your System
First, update the package list so your system knows about the latest available packages.
sudo apt update
If your system has pending updates, install them as well.
sudo apt upgrade -y
Step 2: Install Required Packages
Redis uses its own official APT repository. Install the required tools first.
sudo apt install lsb-release curl gpg -y
Step 3: Add the Redis GPG Key
Download and install the official Redis signing key.
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
Set the correct permissions.
sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
Step 4: Add the Official Redis Repository
Add the Redis repository to your system.
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
Refresh the package index.
sudo apt update
Step 5: Install Redis
Now install Redis.
sudo apt install redis -y
This installs:
-
Redis Server
-
redis-cli
-
Redis tools
Step 6: Verify the Installation
Check the installed Redis version.
redis-server --version
You should see output similar to:
Redis server v=8.x.x
The exact version will depend on the latest stable release available when you install it.
Step 7: Check Redis Service Status
Redis starts automatically after installation.
Verify that it is running.
sudo systemctl status redis-server
If everything is working correctly, you'll see the service in the active (running) state.
Press Q to exit the status screen.
Step 8: Enable Redis at Boot
Redis is usually enabled automatically, but you can confirm it with:
sudo systemctl enable redis-server
Step 9: Test Redis
Open the Redis command line interface.
redis-cli
Run the following command:
PING
If Redis is working correctly, it will return:
PONG
Exit Redis by typing:
exit
Useful Redis Service Commands
Restart Redis:
sudo systemctl restart redis-server
Stop Redis:
sudo systemctl stop redis-server
Start Redis:
sudo systemctl start redis-server
Check service status:
sudo systemctl status redis-server
Configure Redis
The main configuration file is located at:
/etc/redis/redis.conf
After making any changes, restart Redis.
sudo systemctl restart redis-server
Allow Remote Connections (Optional)
By default, Redis only accepts local connections, which is the safest option.
If you need to access Redis from another server, edit the configuration file.
sudo nano /etc/redis/redis.conf
Find the following line:
bind 127.0.0.1 -::1
Replace it with:
bind 0.0.0.0
If protected mode is enabled, review your security settings before exposing Redis to the internet. Never allow public access without authentication and firewall rules.
Save the file and restart Redis.
sudo systemctl restart redis-server
Open the Firewall (Optional)
If you're using UFW and want to allow Redis from trusted systems only:
sudo ufw allow from YOUR_SERVER_IP to any port 6379
Replace YOUR_SERVER_IP with the IP address of the server that should be allowed to connect.
Avoid opening port 6379 to everyone.
Uninstall Redis
If you no longer need Redis, remove it with:
sudo apt remove redis -y
To remove unused packages as well:
sudo apt autoremove -y
Conclusion
You have successfully installed the latest version of Redis on Ubuntu 26.04 using the official Redis repository. Your Redis server is now running as a system service, starts automatically after reboot, and is ready for use with applications such as Laravel, Django, Node.js, Next.js, NestJS, and many other frameworks.

