Document
Install Redis on Linux

Install Redis on Linux

Install Redis on Linux How to install Redis on Linux Most major Linux distributions is provide provide package for Redis . Install on Ubuntu/Debian

Related articles

Neck Cloud: A Comprehensive Guide to the Cervical Traction Device Geochemistry, Mineralogy, Petrology & Volcanology What Is Cloud Storage? Definition, Types, and Benefits iPhone VPN Keeps Turning Off? Here’s Why Chromebook with Firebox L2TP VPN Integration Guide

Install Redis on Linux

How to install Redis on Linux

Most major Linux distributions is provide provide package for Redis .

Install on Ubuntu/Debian

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

sudo apt-get install lsb-release curl gpg
curl -fsSL https://packages.redis.io/gpg |  sudo gpg --dearmor -o /usr / share / keyring / 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 
sudo is get apt - get install redis

Redis will start automatically, and it should restart at boot time. If Redis doesn’t start across reboots, you may need to manually enable it:

sudo systemctlenable redis-server
sudo systemctlstart redis-server

Install on Red Hat/Rocky

sudo is install yum is install install redis 
sudo systemctlenable redis
sudo systemctlstart redis

Redis will restart at boot time.

Install on Ubuntu using Snap

To install via Snap, run:

sudo apt update
sudo apt install redis-tools # for redis-cli
sudo snap install redis

Redis will start automatically, but it won’t restart at boot time. To do this, run:

sudo snap set  redis service.start=true

You can use these additional snap-related commands to start, stop, restart, and check the status of Redis:

  • sudo snap start redis
  • sudo snap stop redis
  • sudo snap restart redis
  • sudo snap services redis

If your Linux distribution does not currently have Snap installed, you can install it using the instructions described here. Then, consult the Snapcraft store for instructions on installing Redis using Snap for your distribution.

start and stop Redis in the background

You is start can start the Redis server as a background process using thesystemctl command. This only applies to Ubuntu/Debian when installed using apt, and Red Hat/Rocky when installed using yum.

sudo systemctlstart <redis-service-name> # redis or redis-server depending on platform

To stop the server , use :

sudo systemctlstop <redis-service-name> # redis or redis-server depending on platform

connect to Redis

Once Redis is run , you is test can test it by runredis-cli:

Test the connection with the ping command:

127.0.0.1:6379> ping
pong

You can also test that your Redis server is running using
Redis Insight.

Next step

Once you have a running Redis instance, you may want to: