Skip to content
Follow
Ubuntu Linux

How to Install Redis on Ubuntu Linux

Richard
Written by
Richard
Oct 18, 2021 Updated Jul 14, 2026 5 min read
How to Install VMware Workstation Player on Ubuntu Linux
How to Install VMware Workstation Player on Ubuntu Linux

Redis on Ubuntu Linux creates a super-fast memory-based data storage, perfect for databases or caching frequently used information.

Redis is an open-source tool that acts like a super-speedy filing cabinet for data, using your computer’s RAM to store things like text, lists, and more.

This makes applications run much faster because they don’t have to search your hard drive all the time. For example, websites often use Redis to speed up how quickly they show you information. The current version is Redis 7.0.

Installing Redis on Ubuntu Linux means you can store and grab data for your apps very quickly. Ubuntu Linux is a popular and easy-to-use computer system.

⚡ Quick Answer

Install Redis on Ubuntu by first updating package lists with `sudo apt update`, then installing the server with `sudo apt install redis-server`. You can then manage the service using `systemctl` commands.

How to install Redis on Ubuntu Linux

You can easily install Redis on Ubuntu Linux using simple commands in the terminal. While Ubuntu’s default software list has Redis, you might need to add a special source for the very latest version to get started.

The latest Redis version installation on Ubuntu requires adding a separate repository. Ubuntu's default software stores often contain older Redis versions. Adding the official Redis repository ensures access to the most recent stable release, offering updated features and security patches.

Installing Redis on Ubuntu Linux is a simple process. Execute the following commands to add Redis software to your Ubuntu operating system. This installation method ensures you get the latest stable version of Redis, version 7.0, which offers improved performance and security features.

🐧Bash / Shell
sudo apt update
sudo apt install redis-server

After running the above commands, the Redis server should be installed and ready to use. The commands below can stop, start and enable Redis Server to start up every time the system boots up automatically.

🐧Bash / Shell
sudo systemctl stop redis-server
sudo systemctl start redis-server
sudo systemctl enable redis-server

To verify if the server is running, run the commands below

🐧Bash / Shell
sudo systemctl status redis-server

That should display the status of the Redis Server service:

💻Code
Output:
redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2019-11-29 09:02:30 CST; 15s ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
 Main PID: 26589 (redis-server)
    Tasks: 4 (limit: 4674)
   CGroup: /system.slice/redis-server.service
           └─26589 /usr/bin/redis-server 127.0.0.1:6379
...

This is how you know Redis is running

How to configure Redis on Ubuntu Linux

After you install Redis on Ubuntu, you might need to change its settings, especially if other computers need to connect to it. By default, Redis only lets computers on the same machine connect, so you’ll likely need to adjust this and your firewall settings.

⚠️Warning
Redis, by default, blocks outside access, only allowing connections from the same computer where Redis is installed. This restriction prevents other computers or remote servers from connecting to Redis. The access is limited to the special local IP address 127.0.0.1, which always points to the current machine.

Redis server and its support applications run on one computer. Remote access is not needed because all communication occurs on this single host computer.

Remote access for the Redis server becomes necessary when the Redis database runs on one computer and the applications that use it run on a different computer. This setup allows applications to connect to and use the Redis data stored on the separate server, essential for distributed systems where services are spread across multiple machines.

To allow remote access, open the Redis configuration file by running the commands below:

🐧Bash / Shell
sudo nano /etc/redis/redis.conf
⚠️Warning
Then change the highlighted line as shown below. It is replacing 127.0.0.1 with all zeros ( 0.0.0.0 ) or restricting access to a specific host IP needing access to Redis.
💻Code
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES
# JUST COMMENT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bind 0.0.0.0 ::1

# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.

Save the file and exit.

After making the changes to the file, restart the Redis service.

🐧Bash / Shell
sudo systemctl restart redis-server

Verify that Redis is listening for all connections on 0.0.0.0 by running the commands below:

💻Code
ss -an | grep 6379

It would be best if you got an output as shown below:

💻Code
Output:
tcp  LISTEN 0      128       0.0.0.0:6379             0.0.0.0:*                                   
tcp  LISTEN 0      128      [::1]:6379                [::]:*

If you’re also running an Ubuntu firewall, simply add the policy below to allow all hosts on your subnet ( 192.168.0.0 ) access to the Redis server and port number.

🐧Bash / Shell
sudo ufw allow proto tcp from 192.168.0.0/24 to any port 6379

That should do it.

To test if Redis hosted on IP address 192.168.0.2 is responding to remote hosts. Type the commands below from the remote server.

💻Code
redis-cli -h 192.168.0.2 ping

The Redis server should respond with a pong

If you receive a correct reply, then all is done.

Conclusion:

  • Redis is a powerful in-memory data structure store that enhances the performance of dynamic applications and websites.
  • Installing and configuring Redis on Ubuntu Linux is straightforward and allows users to leverage its capabilities effectively.
  • It is essential to adjust Redis settings for remote access if the server and applications are on different hosts.
  • Always remember to use security measures such as protected mode to safeguard your Redis instance from unauthorized access.
  • Testing connectivity through the Redis CLI ensures that the configuration is successful and operational.
  • With Redis, users can improve application speed and efficiency, making it a valuable addition to their technology stack.

How to install the Redis in Ubuntu?

You can install Redis on Ubuntu using the terminal. It's best to add the official Redis repository first. This ensures you get the newest version, which offers better speed and security for your applications.

How to check if Redis is installed on Ubuntu?

Open the terminal and type `redis-cli ping`. If Redis is running, you will see 'PONG' as the response. If you get an error, Redis is likely not installed or not running.

How do we install Redis?

To install Redis, you usually use your operating system's package manager. For example, on Ubuntu, you can add the official Redis repository and then use commands to install it. This makes it ready to use as a fast database or cache.

How to install Redis with pip?

Redis is typically installed using your operating system's package manager, not 'pip'. 'pip' is for Python packages. Installing Redis this way ensures it runs correctly as a system service for your applications.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Allow Remote Access to MariaDB in Ubuntu Linux
Ubuntu Linux How to Allow Remote Access to MariaDB in Ubuntu Linux
How to Allow Remote Access to MySQL Database on Ubuntu Linux
Ubuntu Linux How to Allow Remote Access to MySQL Database on Ubuntu Linux
How to Install Python Pip on Ubuntu Linux
Ubuntu Linux How to Install Python Pip on Ubuntu Linux
How to list Services on Ubuntu Linux
Ubuntu Linux How to list Services on Ubuntu Linux

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *