Back to blog
GuidesSeptember 14, 2026ยท4 min read

How to Install Redis on Ubuntu

How to Install Redis on Ubuntu

How to Install Redis on Ubuntu

Redis installation on Ubuntu requires setting up the official Redis apt repository with its GPG key followed by running sudo apt-get install redis. This way, you get the latest Redis release rather than the particular version of Redis provided by Ubuntu repositories. This article discusses this process, checking Redis status, and applying a configuration change that survives Redis restarts.

How do I install Redis on Ubuntu?

Set up the official Redis apt repository with its GPG key, then run sudo apt-get install redis. This way, you get the latest Redis release rather than the particular version of Redis provided by Ubuntu repositories.

$ sudo apt-get install lsb-release curl gpg
$ curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
$ sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
$ 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
$ sudo apt-get update
$ sudo apt-get install redis

It's the exact sequence from Redis's own Linux installation documentation โ€“ the lsb_release -cs part fetches your specific Ubuntu code name, so the same sequence works regardless of whether you're running 22.04, 24.04 or any other version of Ubuntu.

Why use the official Redis apt repository instead of Ubuntu's default package?

Ubuntu's default repository doesn't follow new Redis releases very carefully, so the version provided by it is far away from the latest Redis release most of the time. Official packages.redis.io apt repository is maintained by the Redis project.

Source

Who maintains it

Update cadence

Ubuntu's default redis package

Ubuntu/Debian maintainers

Tied to the Ubuntu release cycle

packages.redis.io apt repository

Redis project

Follows Redis's own release schedule

Same installation documentation recommends packages.redis.io apt repository in particular for Ubuntu/Debian due to the above reason. A bit more configuration upfront in exchange for being able to use the latest version of Redis.

How do I check that Redis is running?

Run redis-cli and enter ping command. A running Redis server will respond with PONG. Alternatively, you can use sudo systemctl status redis-server.

$ redis-cli
127.0.0.1:6379> ping
PONG

Both approaches are taken straight from the official installation documentation: redis-cli proves that the server is ready to accept commands, systemctl status proves that the service itself is running, which may be useful to verify separately if redis-cli cannot connect to the server at all.

How do I enable Redis to start automatically on boot?

Use sudo systemctl enable redis-server, then sudo systemctl start redis-server if it's not running. This will make sure that Redis starts automatically at each subsequent boot.

$ sudo systemctl enable redis-server
$ sudo systemctl start redis-server

These are the exact two commands from Redis installation documentation to make Redis start automatically. Without enable, Redis starts only in the current session and requires manual start after each reboot.

How do I apply a Redis configuration change without losing it on restart?

Edits to redis.conf are permanent starting with Redis restart. Configuration changes made via CONFIG SET command are lost on Redis restart unless you also use CONFIG REWRITE to persist them to the configuration file.

$ redis-cli CONFIG SET maxmemory 256mb
$ redis-cli CONFIG REWRITE

Redis' official documentation on dynamic configuration is very clear on this matter: "modifying the configuration on the fly does not affect the redis.conf and redis-full.conf files, so at the next restart of Redis, the old configuration will be used instead" โ€“ CONFIG REWRITE, per the same page, "will automatically scan your configuration files and update the fields that don't match the current configuration value."

Our VPS plans and Bare Metal servers let you manage your apt repositories and systemd exactly as described above.

Get started with Orbit Servers

Low-latency VPS, bare metal, and colocation across the US, EU, and APAC - provisioned instantly and built for performance-critical workloads.

Get started
J

Written by

Julius

Related posts