Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save LinuxDevOpsGirl/6cba8a2d3770578e8b57623ef82326aa to your computer and use it in GitHub Desktop.
Save LinuxDevOpsGirl/6cba8a2d3770578e8b57623ef82326aa to your computer and use it in GitHub Desktop.
How To Install and Secure Redis on Ubuntu 18.04
Redis?
Redis is an in-memory data structure project implementing a distributed, in-memory key-value database with optional durability.
What is Redis used for?
According to Redis homepage, Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. It supports various data structures such as Strings, Hashes, Lists, Sets etc.
How To Install and Secure Redis on Ubuntu 18.04:
sudo apt update && sudo apt upgrade -y
sudo apt-get install redis-server -y
sudo nano /etc/redis/redis.conf
Inside the file, find the supervised directive. This directive allows you to declare an init system to manage Redis as a service, providing you with more control over its operation. The supervised directive is set to no by default. Since you are running Ubuntu, which uses the systemd init system, change this to systemd:
/etc/redis/redis.conf
. . .
# If you run Redis from upstart or systemd, Redis can interact with your
# supervision tree. Options:
# supervised no - no supervision interaction
# supervised upstart - signal upstart by putting Redis into SIGSTOP mode
# supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
# supervised auto - detect upstart or systemd method based on
# UPSTART_JOB or NOTIFY_SOCKET environment variables
# Note: these supervision methods only signal "process is ready."
# They do not enable continuous liveness pings back to your supervisor.
supervised systemd
sudo systemctl restart redis-server.service
sudo systemctl status redis-server.service
sudo apt-get install php-redis
php -v
redis-cli
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> exit
redis-cli info
redis-cli info stats
redis-cli info server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment