Home → Articles → How to Install Redis In-Memory Database on Ubuntu 26.04

How to Install Redis In-Memory Database on Ubuntu 26.04

02 Apr, 2026

Introduction

Redis is an open-source, in-memory data structure store that functions as a database, cache, and message broker. Unlike traditional databases that store data on disk, Redis keeps data in memory, enabling sub-millisecond response times for read and write operations. The database supports various data structures including strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams. Redis powers real-time applications like session management, leaderboards, rate limiting, job queues, and full-page caching for high-traffic web services.

This guide shows you how to install Redis on Ubuntu 26.04.

Prerequisites

Before you start:

Install Redis from Ubuntu Repository

The Redis package is available by default on the Ubuntu repositories. Installing from the official repository provides a stable version tested for Ubuntu compatibility.

Manage Redis Service

Redis runs as a system service on Ubuntu under the name redis-server. You can manage this service using specific commands to start, stop, restart, and check the Redis status. These commands ensure your Redis installation runs smoothly and make maintenance easier on your system.

Check Redis Service Status

console
$ sudo systemctl status redis-server

Output:

● redis-server.service - Advanced key-value store
     Loaded: loaded (/usr/lib/systemd/system/redis-server.service; enabled; preset: enabled)
     Active: active (running) since Thu 2026-03-12 14:22:10 UTC; 1min 5s ago
       Docs: http://redis.io/documentation,
             man:redis-server(1)
   Main PID: 12456 (redis-server)
     Status: "Ready to accept connections"
      Tasks: 5 (limit: 2271)
     Memory: 8.9M (peak: 9.2M)
        CPU: 234ms
     CGroup: /system.slice/redis-server.service
             └─12456 "/usr/bin/redis-server *:6379"

Press Ctrl + C.

Start Redis Service

console
$ sudo systemctl start redis-server

Stop Redis Service

console
$ sudo systemctl stop redis-server

Restart Redis Service

console
$ sudo systemctl restart redis-server

Enable Redis to Start on Boot

console
$ sudo systemctl enable redis-server

Output:

Synchronizing state of redis-server.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable redis-server

Test Redis Locally

Before configuring remote access, test that Redis works correctly on your local server. The redis-cli command-line tool connects to Redis and executes commands.

Configure Redis with Password Authentication

By default, Redis does not require a password for connections. Securing Redis with a password prevents unauthorized access from remote clients.

Configure Redis to Accept Remote Connections

By default, Redis binds only to localhost for security reasons. To allow remote clients to connect, you need to modify the bind address in the configuration file.

Configure Firewall for Redis

If UFW (Uncomplicated Firewall) is active on your Ubuntu server, you need to allow traffic on port 6379, which is the default port Redis uses.

Test Redis Remotely

From a remote machine with Redis CLI installed, test that you can connect to your Redis server using the password.

Configure Redis Memory Management

Redis stores all data in memory, so you should configure maximum memory limits and eviction policies to prevent out-of-memory crashes.

Monitor Redis Performance

Redis provides built-in commands to monitor performance metrics, connected clients, and memory usage.

Test Redis Persistence

Redis can persist data to disk using RDB (Redis Database) snapshots or AOF (Append Only File) logging. Verify that your data survives a service restart.

Your Redis installation maintains data across restarts.

Conclusion

In this guide, you have installed Redis on Ubuntu 26.04 using apt, secured the database with password authentication, configured remote access, opened the firewall port, and managed memory limits with eviction policies. You also tested local and remote connections, monitored performance metrics, and verified data persistence across service restarts. Now that you have Redis running, consider integrating it with web frameworks like Django or Node.js for session storage, use it as a cache layer in front of PostgreSQL or MySQL, or implement real-time features like leaderboards and message queues using Redis data structures.