Install Redis Server on Linux

Step 1 — Installing

  • sudo apt update
  • sudo apt install redis-server

Step 2 — Testing Redis

Start by checking that the Redis service is running:

  • sudo systemctl status redis


Here, you can see that Redis is running and is already enabled, meaning that it is set to start up every time the server boots.

  • sudo systemctl disable redis

To test that Redis is functioning correctly, connect to the server using the command-line client:

  • redis-cli

In the prompt that follows, test connectivity with the ping command:

  • Output: PONG
  •>set test “It’s working!”
  • Output: OK
  •>get test
  • Output: “It’s working!”

Step 3 — Binding to localhost

sudo nano /etc/redis/redis.conf

Locate this line and make sure it is uncommented (remove the # if it exists):

bind ::1

Then, restart the service to ensure that systemd reads your changes:

  • sudo systemctl restart redis
Last Updated On June 17, 2021