Last active
January 20, 2020 18:42
-
-
Save ispguru/1c1de8e956d001d4c7723042f4276139 to your computer and use it in GitHub Desktop.
How Setup redis in ubuntu 18.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# step-1 : Install and Configuration | |
sudo apt update | |
sudo apt install redis-server | |
sudo nano /etc/redis/redis.conf | |
#The supervised directive is set to no by default. | |
#Since you are running Ubuntu, which uses the systemd init system, change this to systemd. (Supervised systemd) | |
sudo systemctl restart redis.service | |
#step-2 : Testing Redis | |
sudo systemctl status redis | |
sudo systemctl disable redis | |
redis-cli | |
ping | |
set test "It's working!" | |
get test | |
exit | |
sudo systemctl restart redis | |
redis-cli | |
exit | |
#step-3 : Binding Localhost | |
sudo nano /etc/redis/redis.conf | |
#Finf (bind 127.0.0.1 ::1) This line and make sure it is uncommented. And save it | |
sudo systemctl restart redis | |
sudo netstat -lnp | grep redis | |
#Step-4 : Configuring Redis Password | |
sudo nano /etc/redis/redis.conf | |
#Scroll to the SECURITY section and look for a commented directive that reads. | |
#Uncomment it by removing the #, and change foobared to a secure password. And save it | |
openssl rand 60 | openssl base64 -A | |
# copy it and paste as value of requirepass | |
sudo nano /etc/redis/redis.conf | |
sudo systemctl restart redis.service | |
redis-cli | |
set key1 10 | |
auth your_redis_password | |
set key1 10 | |
get key1 | |
quit | |
#Step-5: Renaming Dangerous Commands | |
sudo nano /etc/redis/redis.conf | |
# It is also possible to completely kill a command by renaming it into | |
# an empty string: rename-command SHUTDOWN SHUTDOWN_MENOT, rename-command CONFIG ASC12_CONFIG | |
sudo systemctl restart redis.service | |
redis-cli | |
auth your_redis_password | |
asc12_config get requirepass | |
exit | |
#Youtube Link:https://www.youtube.com/watch?v=ZKCoQ0cn4e4&t=99s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment