Skip to content

Installation: Redis

acozine edited this page May 28, 2013 · 19 revisions
  1. Change to the install directory mkdir -p /opt/install && cd /opt/install
  2. Download redis wget http://download.redis.io/redis-stable.tar.gz
  3. Untar redis tar xvzf redis-stable.tar.gz
  4. Change to the redis directory cd redis-stable/
  5. Compile redis from source make
  6. Test your redis installation. In the redis directory, type make test. You should see a lot of output, with the line "All tests passed without errors!" near the end.
  7. To configure redis, move the server and client:
    sudo cp src/redis-server /usr/local/bin/
    sudo cp src/redis-cli /usr/local/bin/
  8. Make the necessary directories:
    sudo mkdir /etc/redis /var/redis /var/redis/6379
  9. Copy the init script and conf file:
    sudo cp utils/redis_init_script /etc/rc.d/init.d/redis_6379
    sudo cp redis.conf /etc/redis/6379.conf
  10. Edit the conf file to daemonize, set the pidfile, configure logging, and set the home directory:
sudo sed 's/^\(daemonize\ \)no.*$/\\1yes/' -i /etc/redis/6379.conf
sudo sed 's#^\(pidfile\ /var/run/\).*$#\\1redis_6379.pid#' -i /etc/redis/6379.conf
sudo sed 's/^\(loglevel\ \)verbose.*$/\\1notice/' -i /etc/redis/6379.conf
sudo sed 's#^\(dir\ \).*$#\\1/var/redis/6379#' -i /etc/redis/6379.conf
  1. Start redis sudo service redis_6379 start
  2. Confirm functionality and clear the decks for action:
    Type redis-cli ping you should see PONG; type redis-cli save you should see OK.
  3. (CentOS only) Add redis to chkconfig so it starts automatically on start/reboot:
    1. Edit /etc/rc.d/init.d/redis_6379. Immediately after the initial comments, add

added for chkconfig compliance

chkconfig: 2345 95 20

description: redis_6379

Starts the redis server

processname: redis_6379

```

Do not uncomment these lines.
1. Save the file
1. Add redis to chkconfig with sudo chkconfig -add redis_6379.

Clone this wiki locally