Skip to content
Runbook

Install Redis on Ubuntu / Debian

Ultra-fast in-memory key-value database, used as a cache, message broker, and session store.

Cachecachein-memorykey-valuenosqlpub-subbroker

Installation

Server (APT) · apt
sudo apt update
sudo apt install -y redis-server

The redis-server package also installs redis-cli.

Verify the installation

Verify
redis-cli --version

Service

Start
sudo systemctl start redis-server
Stop
sudo systemctl stop redis-server
Status
sudo systemctl status redis-server
Restart
sudo systemctl restart redis-server
On boot
sudo systemctl enable redis-server

Important files

TypePathDescription
config/etc/redis/redis.confMain server configuration file.
data/var/lib/redisPersistence directory (dump.rdb / appendonly.aof).
log/var/log/redis/redis-server.logServer log managed by systemd.

Default ports

6379

Command-line tools

  • redis-cliCommand-line client to interact with the server.
  • redis-serverThe Redis server binary.

Uninstall

Uninstall
sudo systemctl stop redis-server
sudo apt purge -y redis-server
sudo apt autoremove -y

Good to know

  • On Ubuntu/Debian, the systemd unit is called redis-server (not redis). A newer version is available via the official packages.redis.io repository if needed.

Installation on Ubuntu / Debian

The redis-server package from Ubuntu's official repositories provides the server and redis-cli. After sudo apt install -y redis-server, the service is started and enabled automatically by default. To get a more up-to-date version than the one in the distribution's repositories, add Redis's official APT repository (packages.redis.io) — check depending on the version you want.

Service management

The systemd unit is named redis-server on Debian/Ubuntu, which differs from other distributions (where it is simply called redis). Use sudo systemctl status redis-server for the status, and sudo systemctl enable redis-server to ensure startup at boot. Verify connectivity with redis-cli ping (expected response: PONG).

Configuration and security

The /etc/redis/redis.conf file controls the listening address (bind), the password (requirepass), and persistence. By default Redis only listens on 127.0.0.1. If you open it to the network, you must enable requirepass and a firewall. To run Redis under systemd, the supervised systemd directive is usually already set by the package.