How to Install Redis on CentOS and Ubuntu

October 30, 2025 / Servers, Hosting & Email

Redis is an in-memory, encrypted data store that is frequently used for caching, message brokering, and enhancing application speed. Installing and turning on Redis on CentOS and Ubuntu systems is described in this guide.

Why install Redis on CentOS and Ubuntu?

Installing Redis on CentOS or Ubuntu gives you a high-performance, in-memory database that accelerates web applications, supports caching, session management, and message queuing, while offering scalability and persistence for modern development needs.

Install Redis on CentOS

  1. Update System Packages
    Before installing any new software, it’s important to update your system’s package index to guarantee you have the latest versions of dependencies and security patches.

    sudo yum update -y
  2. Install Redis
    Install Redis from CentOS’s default repository. This will also install any required dependencies automatically.

    sudo yum install redis -y
  3. Enable and Start Redis Service
    Enable Redis to start automatically at boot and start the service immediately:

    sudo systemctl enable redis
    sudo systemctl start redis
  4. Verify Redis Service Status
    Check if Redis is running correctly with the following command:

    sudo systemctl status redis

    You should see active (running) in the output, confirming that Redis is up and running.

  5. Test Redis CLI
    Connect to Redis using the command-line interface and send a ping to verify connectivity:

    redis-cli
    ping

    Expected output:

    PONG

    This confirms that Redis is responding to commands.

Install Redis on Ubuntu

  1. Update Package List
    Update your package index to ensure you’re installing the latest available version of Redis:

    sudo apt update
  2. Install Redis
    Install Redis server using Ubuntu’s package manager:

    sudo apt install redis-server -y
  3. Enable and Start Redis
    Make Redis start automatically on boot and start the service immediately:

    sudo systemctl enable redis-server
    sudo systemctl start redis-server
  4. Check Redis Status
    Verify that Redis is running properly:

    sudo systemctl status redis-server

    Look for active (running) to confirm the service is operational.

  1. Test Redis Connectivity
    Use Redis CLI to check if Redis is responding:

    redis-cli
    ping

    Expected output:

    PONG

    A PONG response confirms Redis is working and ready for use.

Secure and Optimise Redis (Optional)

  1. Edit Redis configuration:
    sudo nano /etc/redis/redis.conf
  2. Suggested configurations:
    1. Enable supervision for systemd
    2. Restrict access to localhost
    3. Configure password authentication with requirepass
  3. Restart Redis to apply changes:
    sudo systemctl restart redis

Conclusion

You have successfully installed Redis on both CentOS and Ubuntu systems. With Redis up and running, you can now use its high-speed in-memory capabilities to enhance application performance, implement caching, manage sessions efficiently, and scale your applications seamlessly.

Need to update your system’s host configurations? Learn How to update hosts file entry on Windows, Ubuntu and Mac

Spread the love