← Tous les guides
Redis on Ubuntu
A free, open-source, in-memory key-value store used as a cache, session store, or message broker by countless self-hosted apps -- installed from Ubuntu's package repository.
Ce guide est élaboré à partir de la documentation officielle de Redis on Ubuntu, dont le lien figure ci-dessus — vérifiez toujours les noms exacts des paquets/versions avant d'exécuter ces commandes sur un serveur de production, car les versions de la distribution et du projet évoluent avec le temps.
1Install Redis
sudo apt updatesudo apt install redis-server2Enable it to run as a proper background service
Ubuntu's package defaults to supervised mode off -- switch it to systemd so it starts on boot and restarts on crash correctly.
sudo sed -i 's/supervised no/supervised systemd/' /etc/redis/redis.confsudo systemctl restart redis.service3Set a password if anything other than localhost can reach it
Redis has no authentication by default -- fine for a service only reachable from localhost, a real risk if the port is exposed to the network.
# In /etc/redis/redis.conf, uncomment and set: # requirepass a-real-passwordsudo systemctl restart redis.service4Verify it's running
Should return PONG.
redis-cli ping