How to Install Redis on Debian (13, 12, 11)

Last updated Monday, February 16, 2026 1:00 pm Joshua James 9 min read

Redis is an in-memory data store that can dramatically speed up web applications, cache database queries, and handle real-time session data. Whether you need a fast caching layer for WordPress or Nginx, a message broker between microservices, or a lightweight key-value store for session management, Redis fits the role without heavy infrastructure overhead.

This guide walks through how to install Redis on Debian, verify service health, and apply secure baseline configuration for production use. Three installation methods are covered, including Debian’s default packages and newer upstream releases through extrepo or the official Redis.io repository.

Install Redis on Debian

Update Debian and Install Redis Prerequisites

Start by refreshing your package index and installing pending upgrades so Redis installs against current system packages:

sudo apt update && sudo apt upgrade -y

This guide uses sudo for commands that need root privileges. If your account does not have sudo access yet, follow the Debian guide to add a user to the sudoers group.

Install the packages used by the repository methods in this article:

sudo apt install ca-certificates curl gpg -y

Compare Redis Installation Methods on Debian

Choose one installation method based on how much control you need over package source and update cadence:

MethodPackage SourceVersion TrackBest For
extrepo (Recommended)Debian extrepo metadata for Redis.ioNewer upstream Redis releasesMost users who want newer Redis packages with simpler setup
Debian default repositoryDebian package archiveDebian-maintained Redis versionsUsers who prefer Debian-only package sources
Manual Redis.io repositoryRedis official APT repositorySame upstream track as extrepoAutomation or explicit manual repository control

For most users, the extrepo method is the best default because Debian manages repository metadata while you still receive newer Redis packages than the default Debian archive.

Debian ReleaseDefault Debian RepositoryRedis.io Repository Track
Debian 13 (Trixie)Redis 8.0.xRedis 8.6.x
Debian 12 (Bookworm)Redis 7.0.xRedis 8.6.x
Debian 11 (Bullseye)Redis 6.0.xRedis 7.4.x

The version tracks above use .x notation intentionally. Exact patch versions change as repositories publish updates.

Install Redis on Debian with extrepo (Recommended)

This method enables the Redis repository through Debian’s extrepo metadata and installs Redis in one flow:

sudo apt install extrepo -y
extrepo search redis
sudo extrepo enable redis
sudo apt update
sudo apt install redis -y

The extrepo search redis output should show a Redis entry mapped to your Debian codename:

Found redis:
  Architectures: amd64 all i386 armhf arm64
  Components: main
  Suites: [your-release]
  URIs: https://packages.redis.io/deb

After sudo apt update, confirm APT fetched the Redis.io source:

Hit:1 https://packages.redis.io/deb [your-release] InRelease
Reading package lists... Done

Verify the Redis package source before proceeding with configuration:

apt-cache policy redis
redis:
  Installed: 6:x.x.x-1rl1~[your-release]1
  Candidate: 6:x.x.x-1rl1~[your-release]1
  Version table:
 *** 6:x.x.x-1rl1~[your-release]1 500
        500 https://packages.redis.io/deb [your-release]/main amd64 Packages

Enable Redis at boot, start it now, and verify service health:

sudo systemctl enable --now redis-server
systemctl status redis-server
● redis-server.service - Advanced key-value store
     Loaded: loaded (redis-server.service; enabled; preset: enabled)
     Active: active (running)

On Debian, the systemd unit name is redis-server.service. Using redis.service returns a unit-not-found error.

Install Redis on Debian from the Default Repository

If you prefer Debian-maintained packages only, install redis-server and redis-tools directly from Debian repositories:

sudo apt install redis-server redis-tools -y

Confirm the package source and candidate version:

apt-cache policy redis-server
redis-server:
  Installed: 5:x.x.x-1~debXXuX
  Candidate: 5:x.x.x-1~debXXuX
  Version table:
 *** 5:x.x.x-1~debXXuX 500
        500 http://deb.debian.org/debian [your-release]/main amd64 Packages

Enable and start the service:

sudo systemctl enable --now redis-server

Confirm that Redis is active:

systemctl status redis-server
● redis-server.service - Advanced key-value store
     Loaded: loaded (redis-server.service; enabled; preset: enabled)
     Active: active (running)

Install Redis on Debian with the Manual Redis.io Repository

Use this method when you want explicit repository file control for automation. If you want more flag examples for download commands, see the LinuxCapable curl command guide.

Import the Redis signing key into a Debian keyring path:

curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg

Create a DEB822 repository file that detects your Debian codename from /etc/os-release:

CODENAME=$(. /etc/os-release && echo "$VERSION_CODENAME")
ARCH=$(dpkg --print-architecture)

sudo tee /etc/apt/sources.list.d/redis.sources > /dev/null <<EOF
Types: deb
URIs: https://packages.redis.io/deb
Suites: ${CODENAME}
Components: main
Architectures: ${ARCH}
Signed-By: /usr/share/keyrings/redis-archive-keyring.gpg
EOF

Update APT metadata and install Redis:

sudo apt update
sudo apt install redis -y
Hit:1 https://packages.redis.io/deb [your-release] InRelease
Reading package lists... Done

Verify Redis is coming from the Redis.io repository:

apt-cache policy redis
redis:
  Installed: 6:x.x.x-1rl1~[your-release]1
  Candidate: 6:x.x.x-1rl1~[your-release]1
  Version table:
 *** 6:x.x.x-1rl1~[your-release]1 500
        500 https://packages.redis.io/deb [your-release]/main amd64 Packages

Start Redis and verify the installed server version:

sudo systemctl enable --now redis-server
redis-server --version
Redis server v=x.x.x sha=00000000:0 malloc=jemalloc-5.3.0 bits=64 build=...

Test Redis on Debian

Check That Redis Listens on Localhost

Redis should listen on localhost by default after installation:

ss -tlnp | grep redis-server
LISTEN 0      511        127.0.0.1:6379       0.0.0.0:*    users:(("redis-server",pid=1234,fd=6))

Run a Redis Ping Test

Use redis-cli to verify that Redis responds to commands:

redis-cli ping
PONG

Verify the Redis Service Account on Debian

Installing redis-server creates a dedicated non-login system account. Verify the account exists:

getent passwd redis
redis:x:10x:10x::/var/lib/redis:/usr/sbin/nologin

If authentication is enabled, run the same test with your configured password:

redis-cli -a 'YourStrongPasswordHere' ping
PONG

Configure Redis on Debian

Baseline Redis hardening usually includes memory limits, explicit binding rules, and password authentication before exposing Redis beyond localhost.

Open the Redis Configuration File

sudo nano /etc/redis/redis.conf

Set Redis Memory Limits and Eviction Policy

For cache workloads, set a hard memory limit and choose an eviction policy that matches your data access pattern:

maxmemory 500mb
maxmemory-policy allkeys-lru

Configure Redis Network Binding and Password Authentication

Keep localhost binding unless remote access is required. If remote access is required, bind only trusted interfaces and always set a password:

bind 127.0.0.1 192.168.1.100
requirepass YourStrongPasswordHere

Redis has a long history of internet-exposed instances being abused for unauthorized data access and malware campaigns. Do not bind Redis to 0.0.0.0 without strict firewall rules and strong authentication.

Apply and Verify Redis Configuration Changes

sudo systemctl restart redis-server
systemctl status redis-server
● redis-server.service - Advanced key-value store
     Loaded: loaded (redis-server.service; enabled; preset: enabled)
     Active: active (running)

Confirm the applied memory settings from Redis itself:

If you enabled requirepass, add -a 'YourStrongPasswordHere' to the command.

redis-cli CONFIG GET maxmemory
redis-cli CONFIG GET maxmemory-policy
maxmemory
524288000
maxmemory-policy
allkeys-lru

Configure UFW Firewall Rules for Redis on Debian

If Redis must accept remote connections, restrict port 6379 to known source addresses only. For broader policy examples, see the Debian UFW configuration guide.

Install UFW and Allow SSH Before Enabling the Firewall

Install UFW, allow SSH first, then enable the firewall:

sudo apt install ufw -y
sudo ufw allow ssh
sudo ufw enable
Rules updated
Rules updated (v6)
Firewall is active and enabled on system startup

If you are connected over SSH, allowing SSH traffic before enabling UFW prevents remote lockout.

Allow Redis Access from Trusted Hosts

Choose one rule set based on how clients connect to Redis.

Allow One Redis Client Host

sudo ufw allow proto tcp from 192.168.1.50 to any port 6379

Allow a Private Redis Client Subnet

sudo ufw allow proto tcp from 192.168.1.0/24 to any port 6379

Verify Redis UFW Rules

sudo ufw status numbered
Status: active

     To                         Action      From
     --                         ------      ----
[ 1] 22/tcp                     ALLOW IN    Anywhere
[ 2] 6379/tcp                   ALLOW IN    192.168.1.50
[ 3] 22/tcp (v6)                ALLOW IN    Anywhere (v6)

From an allowed client, test network access with Redis authentication:

redis-cli -h 192.168.1.100 -a 'YourStrongPasswordHere' ping
PONG

Tune Redis Performance on Debian

These tuning directives help you profile slower commands and improve connection behavior under typical web workloads.

Configure Redis Slow Log Thresholds

slowlog-log-slower-than 10000
slowlog-max-len 128

After restarting Redis, check how many entries are currently in slow log:

If authentication is enabled, run this with redis-cli -a 'YourStrongPasswordHere' slowlog len.

redis-cli slowlog len
0

Adjust Redis TCP Keepalive and Logging Level

tcp-keepalive 300
loglevel notice

The tcp-keepalive setting helps close stale client sessions, and loglevel notice keeps operational logs useful without debug-level noise.

Restart Redis After Performance Tuning

sudo systemctl restart redis-server
systemctl status redis-server
● redis-server.service - Advanced key-value store
     Loaded: loaded (redis-server.service; enabled; preset: enabled)
     Active: active (running)

Troubleshoot Redis on Debian

Use these tested diagnostics for the Redis errors most often reported on Debian systems.

Redis Service Name Error: Unit redis.service Not Found

If you start Redis with redis.service, systemd returns a unit-not-found error:

Failed to enable unit: Unit file redis.service does not exist.

List available Redis units to confirm the correct service name:

systemctl list-unit-files | grep redis
redis-server.service   enabled
redis-server@.service static

Use redis-server.service for enable/start operations:

sudo systemctl enable --now redis-server
systemctl status redis-server
Active: active (running)

redis-cli Command Not Found on Debian

If Redis client tools are missing, shell output usually looks like this:

bash: redis-cli: command not found

Install the Redis client package and verify the client binary:

sudo apt install redis-tools -y
redis-cli --version
redis-cli x.x.x

NOAUTH Errors After Enabling Redis Password Authentication

After setting requirepass, unauthenticated commands return:

redis-cli ping
(error) NOAUTH Authentication required.

Retry with your configured Redis password:

redis-cli -a 'YourStrongPasswordHere' ping
PONG

Remote Redis Connection Refused Errors

Applications on remote hosts can fail with connection-refused errors when Redis is still bound to localhost or UFW rules are missing.

RedisException: Connection refused

Run these checks on the Redis server:

grep "^bind" /etc/redis/redis.conf
sudo ufw status numbered
ss -tlnp | grep 6379

If you want to refine pattern filters in the diagnostic command, use the LinuxCapable grep command guide.

bind 127.0.0.1 192.168.1.100
Status: active
[ 2] 6379/tcp ALLOW IN 192.168.1.50
LISTEN 0 511 192.168.1.100:6379 0.0.0.0:*

If any check is missing expected output, fix bind, firewall rules, or service state, then restart Redis and test again from the client host.

Remove Redis from Debian

When Redis is no longer needed, remove packages, repository configuration, and optional Redis data directories.

Stop Redis and Remove Redis Packages

sudo systemctl stop redis-server
sudo systemctl disable redis-server
sudo apt remove --purge redis redis-server redis-tools -y
sudo apt autoremove -y

Remove Redis Repository Configuration on Debian (If Used)

If you installed Redis through extrepo, disable the extrepo entry and refresh APT metadata:

sudo extrepo disable redis
sudo apt update

For complete extrepo cleanup, remove the disabled source file and extrepo key:

sudo rm -f /etc/apt/sources.list.d/extrepo_redis.sources
sudo rm -f /var/lib/extrepo/keys/redis.asc
sudo apt update

If you used the manual Redis.io method, remove the DEB822 file and keyring:

sudo rm -f /etc/apt/sources.list.d/redis.sources
sudo rm -f /usr/share/keyrings/redis-archive-keyring.gpg
sudo apt update

The next command permanently deletes Redis data in /var/lib/redis, logs in /var/log/redis, and local Redis configuration files in /etc/redis. Export data first if you need to keep existing datasets or configuration.

sudo rm -rf /var/lib/redis /var/log/redis /etc/redis

Verify Redis Removal on Debian

apt-cache policy redis-server
redis-server:
  Installed: (none)
  Candidate: x.x.x
  Version table:

If Installed: (none) is shown, Redis packages are removed successfully. A candidate version may still appear when Debian repositories remain enabled, which is expected.

Frequently Asked Questions

Is Redis available in Debian default repositories?

Yes. Redis is available in Debian 13, Debian 12, and Debian 11 default repositories. These packages are Debian-maintained and can be older than Redis.io packages.

Which package provides redis-cli on Debian?

The redis-cli command is provided by the redis-tools package. Install it with sudo apt install redis-tools if the client command is missing.

Why does systemctl show Unit redis.service not found?

Debian packages register Redis as redis-server.service, not redis.service. Use sudo systemctl enable --now redis-server and check status with systemctl status redis-server.

Does Debian create a redis user automatically during installation?

Yes. Installing redis-server creates a dedicated redis system account with /var/lib/redis as its home and a non-login shell.

Conclusion

Redis is now running on Debian with password authentication, memory limits, and firewall rules ready for production traffic. To build out a full application stack, pair Redis with Nginx on Debian for web serving, MariaDB on Debian for persistent storage, or tighten network access further with the Debian UFW firewall guide.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffee Buy me a coffee

Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Leave a Comment

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: