Skip to content

Installation: Redis

mark-dce edited this page May 28, 2013 · 19 revisions

To install redis from source:
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable/
make

To test redis:
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.

To configure redis, move the server and client:
sudo cp src/redis-server /usr/local/bin/
sudo cp src/redis-cli /usr/local/bin/
make the necessary directories:
sudo mkdir /etc/redis
sudo mkdir /var/redis
sudo mkdir /var/redis/6379
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
edit the conf file to daemonize, set the pidfile, configure logging, and set the home directory:

sudo sed -i -r 's/^(daemonize\s)no.*$/\\1yes/' /etc/redis/6379.conf  
sudo sed -i -r 's#^(pidfile\s/var/run/).*$#\\1redis_6379.pid#' /etc/redis/6379.conf  
sudo sed -i -r 's/^(loglevel\s)verbose.*$/\\1notice/' /etc/redis/6379.conf  
sudo sed -i -r 's#^(dir\s).*$#\\1/var/redis/6379#' /etc/redis/6379.conf  

Start redis, confirm functionality, and clear the decks for action:
Type redis-cli ping you should see "PONG"; type redis-cli save you should see "OK". Delete the data dump with sudo rm /var/redis/6379/dump.rb.

If you're using CentOS, add redis to chkconfig so it starts automatically on start/reboot:
Edit /etc/rc.d/init.d/redis_6379 and under the top line, add
# added for chkconfig compliance
# chkconfig: 2345 95 20
# description: redis_6379
# Starts the redis server
# processname: redis_6379
Do not uncomment these lines. Save the file, then add redis to chkconfig with sudo chkconfig -add redis_6379.

Clone this wiki locally