How to Install Redis 8 on Ubuntu 24.04 and Allow Remote Access

Add the official Redis repository to an Ubuntu 24.04 server and install Redis 8, set an admin password and create a dedi…

Ubuntu 24.04Redis 8.10x86_64About 9 min

Verified guide

This guide was verified by creating a cloud server and running every command in it, from start to finish, exactly as written.

OS
Ubuntu 24.04.5 LTS · x86_64
Installed version
Redis 8.10.2 (6:8.10.2-1rl1~noble1)
Test server
DigitalOcean · 1 vCPU / 1 GB RAM / 25 GB SSD (s-1vcpu-1gb, sgp1)
Last checked
2026-10-10

This guide contains affiliate links. If you sign up through them, Codesand may earn a commission. This doesn't affect the content or our assessments.

Add the official Redis repository to an Ubuntu 24.04 server and install Redis 8, set an admin password and create a dedicated user for applications, and then configure remote access and the firewall so that only your PC can connect.

1. Requirements

  • One Ubuntu 24.04 LTS server (1 GB of memory or more recommended)
  • SSH access with an account that has sudo privileges
  • The public IP address of the PC you will connect from (e.g. 203.0.113.10)

If you don't have a server, create the smallest DigitalOcean Droplet (1 vCPU · 1 GB). This Droplet is enough to install Redis 8. Every step in this guide was verified on a server created as a Droplet (1 vCPU · 1 GB memory · 25 GB SSD · Ubuntu 24.04 · Singapore).

2. Add the official Redis repository

The Redis version installed from the default Ubuntu 24.04 repositories is 7.0.

apt-cache policy redis-server | head -4
redis-server:
  Installed: (none)
  Candidate: 5:7.0.15-1ubuntu0.24.04.4
  Version table:

To install Redis 8, add the official Redis repository (packages.redis.io). First, install the tools you need. Most of them are already installed on Ubuntu 24.04.

sudo apt update
sudo apt install -y lsb-release curl gpg

Download and save the repository signing key, then register the repository address. The signing key is used to check that the packages you download were made by Redis. $(lsb_release -cs) is replaced with noble, the code name of Ubuntu 24.04.

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
deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb noble main

Update the package list, then check the version to be installed again. If Candidate starts with 8, it is working.

sudo apt update
apt-cache policy redis-server | head -4
redis-server:
  Installed: (none)
  Candidate: 6:8.10.2-1rl1~noble1
  Version table:

3. Install Redis 8

Installing the redis package installs the server (redis-server) and the command-line tools (redis-tools) together.

sudo apt install -y redis

When the installation finishes, check the installed version.

redis-server --version
Redis server v=8.10.2 sha=00000000:1 malloc=jemalloc-5.3.0 bits=64 build=677c1e5d953828c4

4. Check the service status

When the installation finishes, the redis-server service starts automatically and is registered to start automatically when the server restarts.

sudo systemctl status redis-server --no-pager
● redis-server.service - Advanced key-value store
     Loaded: loaded (/usr/lib/systemd/system/redis-server.service; enabled; preset: enabled)
     Active: active (running) since Sat 2026-10-10 08:03:21 UTC; 9s ago

Check that you can connect to Redis. If PONG is displayed, it is working.

redis-cli ping
PONG

Check which addresses Redis accepts connections on.

sudo ss -tlnp | grep 6379
LISTEN 0      511        127.0.0.1:6379      0.0.0.0:*    users:(("redis-server",pid=7586,fd=20))
LISTEN 0      511            [::1]:6379         [::]:*    users:(("redis-server",pid=7586,fd=21))

Only 127.0.0.1 and [::1] are displayed, so for now you can connect only from the server itself. This behavior is set by the following entries in the configuration file /etc/redis/redis.conf.

grep -n -E '^(bind|protected-mode|port|supervised|# requirepass|loadmodule)' /etc/redis/redis.conf
88:bind 127.0.0.1 -::1
112:protected-mode yes
139:port 6379
389:supervised auto
1145:# requirepass foobared
2753:loadmodule /usr/lib/redis/modules/redisbloom.so
2754:loadmodule /usr/lib/redis/modules/redisearch.so
2755:loadmodule /usr/lib/redis/modules/rejson.so
2756:loadmodule /usr/lib/redis/modules/redistimeseries.so
  • bind: The server addresses that accept connections. 127.0.0.1 (IPv4) and ::1 (IPv6) are both addresses of the server itself. The leading - means that Redis starts without an error even if that address is not available.
  • protected-mode: A feature that blocks remote connections when the default user has no password.
  • requirepass: The password setting. Because it starts with #, you can currently connect without a password.
  • loadmodule: Features included in the official Redis 8 package. Probabilistic data structures (redisbloom), search (redisearch), JSON (rejson) and time series (redistimeseries) are loaded when Redis starts. You don't need to install them separately.

5. Basic security settings — admin password

Right after installation, Redis lets you run every command without a password. Before you allow remote connections, set a password for the default user (default). The default user can run every command, so use this password as the admin password. Be sure to replace the password with a value of your own.

sudo sed -i 's/^# requirepass foobared/requirepass change-this-admin-password/' /etc/redis/redis.conf
sudo grep -n '^requirepass' /etc/redis/redis.conf
1145:requirepass change-this-admin-password

After you restart Redis, commands are refused if you connect without a password.

sudo systemctl restart redis-server
redis-cli ping
NOAUTH Authentication required.

With the --askpass option, you are asked for the password, and then the command runs. The password you enter is displayed as *.

redis-cli --askpass ping
Please input password: **************************
PONG

6. Create a dedicated user

It is safer for applications to connect as a dedicated user with limited permissions instead of using the admin password. Create the user appuser with ACL. Redis has no command to create a separate database as MySQL and PostgreSQL do, so the key name prefix (app:) sets the range this user can use.

echo 'user appuser on >change-this-password ~app:* +@all -@dangerous' | sudo tee -a /etc/redis/redis.conf
sudo systemctl restart redis-server
user appuser on >change-this-password ~app:* +@all -@dangerous
  • on: Makes the user available for use.
  • >change-this-password: The value after > is this user's password.
  • ~app:*: The user can read and write only keys whose names start with app:.
  • +@all -@dangerous: Allows all commands, then excludes the command group (@dangerous) that affects the whole server, such as FLUSHALL, CONFIG, KEYS and INFO.

Check with the admin password that the user was created.

redis-cli --askpass ACL USERS
Please input password: **************************
1) "appuser"
2) "default"

Connect as appuser with the --user option, then store and read a key that starts with app:.

redis-cli --user appuser --askpass SET app:hello world
Please input password: ********************
OK
redis-cli --user appuser --askpass GET app:hello
Please input password: ********************
"world"

Keys and commands that are not allowed are refused. If the two errors below are displayed, the permissions are applied as intended.

redis-cli --user appuser --askpass SET other:hello world
Please input password: ********************
(error) NOPERM No permissions to access a key
redis-cli --user appuser --askpass FLUSHALL
Please input password: ********************
(error) NOPERM User appuser has no permissions to run the 'flushall' command

appuser can also use the JSON feature you saw in step 4, because +@all includes the JSON commands. $ means the whole JSON document, and $.name means the name field.

redis-cli --user appuser --askpass JSON.SET app:user:1 '$' '{"name":"kim","age":30}'
Please input password: ********************
OK
redis-cli --user appuser --askpass JSON.GET app:user:1 '$.name'
Please input password: ********************
"[\"kim\"]"

7. Allow remote connections

The default settings allow only localhost connections. To allow remote connections, change bind to 0.0.0.0. 0.0.0.0 means that Redis accepts connections on all of the server's IPv4 addresses.

sudo sed -i 's/^bind 127.0.0.1 -::1/bind 0.0.0.0/' /etc/redis/redis.conf
grep -n -E '^(bind|protected-mode)' /etc/redis/redis.conf
88:bind 0.0.0.0
112:protected-mode yes

Leave protected-mode yes as it is. Because you set a password for the default user in step 5, remote connections work even with this setting turned on.

Restart Redis and check that port 6379 is now open on external addresses as well. If you see 0.0.0.0:6379, it is working.

sudo systemctl restart redis-server
sudo ss -tlnp | grep 6379
LISTEN 0      511          0.0.0.0:6379      0.0.0.0:*    users:(("redis-server",pid=9065,fd=20))

8. Configure the firewall (ufw)

Separately from the Redis settings, allow only your PC's IP to reach port 6379 in the firewall as well. Always allow SSH before you enable the firewall. If you enable the firewall without allowing SSH, your connection to the server is cut off.

sudo ufw allow OpenSSH
sudo ufw allow from 203.0.113.10 to any port 6379 proto tcp
sudo ufw --force enable
sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
6379/tcp                   ALLOW       203.0.113.10
OpenSSH (v6)               ALLOW       Anywhere (v6)

9. Check the connection from your PC

If redis-cli isn't installed on your PC, you can run the Redis client with Docker and connect. Replace 203.0.113.20 with the server's IP. Because the --rm option is added, the container is deleted automatically when the command finishes. -it is an option that attaches a terminal so that you can enter the password.

docker run --rm -it redis:8 redis-cli -h 203.0.113.20 --user appuser --askpass GET app:hello
Please input password: ********************
"world"

If the value you stored in step 6 is displayed, remote access is working. Also check that commands are refused when you connect without a password.

docker run --rm -it redis:8 redis-cli -h 203.0.113.20 PING
(error) NOAUTH Authentication required.

10. Troubleshooting

Could not connect to Redis at 203.0.113.20:6379: Connection refused

This means that Redis is not accepting connections on external addresses. You get this error if you connect remotely before changing bind. Check with grep -n -E '^(bind|protected-mode)' /etc/redis/redis.conf that it is bind 0.0.0.0, and check that you ran sudo systemctl restart redis-server after changing it.

NOAUTH Authentication required.

This means that you ran a command without a password. After setting requirepass, connect with redis-cli --askpass (admin) or redis-cli --user appuser --askpass (dedicated user).

AUTH failed: WRONGPASS invalid username-password pair or user is disabled.

This means that the user name or password is wrong. Without --user, the password is checked against the default user (the admin password). To connect as appuser, add --user appuser and enter the password of appuser. (error) NOAUTH Authentication required. is displayed on the line after this error.

(error) NOPERM No permissions to access a key

This means that you used a key that appuser is not allowed to use. This guide allows only keys that start with app:, through ~app:*. To allow keys with other names, add a key pattern starting with ~ to the user appuser line in redis.conf and restart Redis.

NOPERM User appuser has no permissions to run the 'info' command

This means that you ran a command excluded by -@dangerous. Running FLUSHALL gives an error in the same format. Run these commands after connecting with the admin password.

11. Uninstall

To delete Redis and all of its data, run the commands below. Because the stored data and configuration files are deleted as well, back up any data you need first.

sudo apt purge -y redis redis-server redis-tools
sudo apt autoremove -y
sudo rm -rf /etc/redis /var/lib/redis /var/log/redis

Also delete the official repository and signing key you added in step 2, then update the package list.

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

Also delete the port 6379 rule you added to the firewall.

sudo ufw delete allow from 203.0.113.10 to any port 6379 proto tcp
Rule deleted

Check that no Redis packages remain. If 0 is displayed, everything has been deleted.

dpkg -l | grep -c redis
0

Try it yourself

No server yet? You can spin up an Ubuntu server in a few minutes with one of these providers. We verified this guide on DigitalOcean.