The YUM installed Redis version on Amazon Linux is an older version so we will go through the steps to install Redis 3.2.6.

redis

  1. sudo -i
  2. yum update
  3. yum install -y gcc*
  4. yum install -y tcl
  5. mkdir /redis
  6. sudo chmod 2775 /redis
  7. cd /redis
  8. wget http://download.redis.io/releases/redis-3.2.6.tar.gz
  9. tar xzf redis-3.2.6.tar.gz
  10. cd redis-3.2.6
  11. make
  12. make test
  13. make install
  14. cd utils
  15. chmod +x install_server.sh
  16. ./install_server.sh
    install with the following values:

    Welcome to the redis service installer
    This script will help you easily set up a running redis server
    
    Please select the redis port for this instance: [6379]
    Selecting default: 6379
    Please select the redis config file name [/etc/redis/6379.conf]
    Selected default - /etc/redis/6379.conf
    Please select the redis log file name [/var/log/redis_6379.log]
    Selected default - /var/log/redis_6379.log
    Please select the data directory for this instance [/var/lib/redis/6379]
    Selected default - /var/lib/redis/6379
    Please select the redis executable path [] /usr/local/bin/redis-server
    Selected config:
    Port : 6379
    Config file : /etc/redis/6379.conf
    Log file : /var/log/redis_6379.log
    Data dir : /var/lib/redis/6379
    Executable : /usr/local/bin/redis-server
    Cli Executable : /usr/local/bin/redis-cli
  17. chkconfig –level 2345 redis_6379 on
  18. chmod 2775 /etc/redis
  19. chmod 664 /etc/redis/6379.conf
  20. edit the /etc/redis/6379.conf file to set a password

That’s All!

ps. Want to set a password on the Redis store? It’s not recommended because a password doesn’t do much to secure a fast memory based key storage when 1000’s of password auth attempts can be thrown at it PER SECOND!  But on the other hand, if you want to add a password to prevent simply prying eyes like inhouse staff that won’t go through the trouble of building a password hacking program. Maybe you think the added password might prevent an inadvertent command to you Redis database like an accidental delete. Regardless the reason, here’s what you need to do:

edit the /etc/redis/6379.conf file
1. add your password to the password line and uncomment it. make it realy long.
2. turn protect mode off in the same file be commenting that line out.
3. (optional) comment the bind statement to allow connections from any interface. If you do this, you better control that port somewhere else, maybe with an AWS security group.

edit the  /etc/init.d/redis_6379 file and add the following command in the start and stop case procedures:

echo "Using Auth Password"
CLIEXEC="/usr/local/bin/redis-cli -a mywickedLong256character?Password"

Now you can do a sudo service redis_6379 restart command.

Advertisements