Skip to content

Instantly share code, notes, and snippets.

@linuxoracledev
Last active December 7, 2019 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linuxoracledev/6ac119b7491c0eff3e3cec57360bf36a to your computer and use it in GitHub Desktop.
Save linuxoracledev/6ac119b7491c0eff3e3cec57360bf36a to your computer and use it in GitHub Desktop.
How To Install, Configure and Secure Redis on Ubuntu 18.04
#Update the system
sudo apt-get update
#Install redis
sudo apt-get install redis-server
#Modify redis.conf file
sudo nano /etc/redis/redis.conf
#Enable supervised to systemd to do so uncomment the line #supervised systemd
#To make redis accessible from localhost uncomment the line #bind 127.0.0.1 ::1
#To set password Scroll to the SECURITY section and look for line #requirepass foobared, Uncomment it by removing the #, and change foobared to a secure password
#supervised systemd
#bind 127.0.0.1 ::1
#requirepass mypass
#Restart the Redis service to reflect the changes
sudo systemctl restart redis.service
#Check redis is bind to localhost or not
sudo netstat -lnp | grep redis
#Check that the Redis service is running
sudo systemctl status redis
#Connect to the server
redis-cli
auth your_redis_password
#Test connectivity
ping
#Check by seting keys
set test "It's working!"
#Retrieve the value
get test
#Exit the Redis prompt
exit
# To check whether Redis is able to persist data even after it’s been stopped or restarted
sudo systemctl restart redis
redis-cli
auth your_redis_password
get test
#View on Youtube : https://youtu.be/nfxqK9H3DJg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment