Linux

Info

Redis version 7.0.5 or higher is required.

Debian/Ubuntu

  1. Add the repository to the APT index, update it, and install Redis:

# add repository
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

# install Redis
sudo apt-get install \
redis=6:8.6.2-1rl1~noble1 \
redis-server=6:8.6.2-1rl1~noble1 \
redis-tools=6:8.6.2-1rl1~noble1
sudo systemctl enable --now redis-server

# check redis-server status
sudo systemctl status redis-server
  1. Access Redis configuration file /etc/redis/redis.conf for editing.

  2. Comment out the bind setting and set protected-mode option to no.

...
# The following line should be commented
# bind 127.0.0.1
...
# The following line should be uncommented and set to no
protected-mode no
...
  1. Restart Redis.

sudo systemctl restart redis-server
  1. Run the command with Redis CLI.

redis-cli ping
  1. Confirm that the response returned is PONG.

PONG

Rocky, RHEL 9

  1. Create the file /etc/yum.repos.d/redis.repo with the following contents.

[Redis]
name=Redis
baseurl=http://packages.redis.io/rpm/rockylinux9
enabled=1
gpgcheck=1
  1. Run the commands.

curl -fsSL https://packages.redis.io/gpg > /tmp/redis.key
sudo rpm --import /tmp/redis.key
sudo dnf install -y redis-8.6.2-1.x86_64
sudo systemctl enable --now redis
sudo systemctl status redis
  1. Access Redis configuration file /etc/redis/redis.conf for editing.

  2. Comment out the bind setting and set protected-mode option to no.

...
# The following line should be commented
# bind 127.0.0.1
...
# The following line should be uncommented and set to no
protected-mode no
...
  1. Restart Redis.

sudo systemctl restart redis
  1. Run the command with Redis CLI.

redis-cli ping
  1. Confirm that the response returned is PONG.

PONG