Skip to content

Instantly share code, notes, and snippets.

@dgroft
Created July 30, 2013 20:31
Show Gist options
  • Save dgroft/6116637 to your computer and use it in GitHub Desktop.
Save dgroft/6116637 to your computer and use it in GitHub Desktop.
Installs Redis on CentOS.
#!/bin/bash
################################################################################
# Installing Redis on CentOS
# with lots of help from:
# * https://gist.github.com/coder4web/5762999
# * http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# * https://coderwall.com/p/ypo94q
# * https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
################################################################################
yum install make gcc tcl
cd ~
# check http://redis.io for updates
wget http://redis.googlecode.com/files/redis-2.6.14.tar.gz
tar xzf redis-2.6.14.tar.gz
cd redis-2.6.14
make
make test
make install
# add to PATH: /usr/local/bin
# ensure these two paths exist:
mkdir /etc/redis
mkdir /var/lib/redis
# modify redis.conf, save changes to redis.conf.modified:
sed -e "s/^daemonize no$/daemonize yes/" -e "s/^dir \.\//dir \/var\/lib\/redis\//" -e "s/^loglevel debug$/loglevel notice/" -e "s/^logfile stdout$/logfile \/var\/log\/redis.log/" < redis.conf > redis.conf.modified
# copy (and rename in the process) redis.conf.modified to under /etc location:
cp redis.conf.modified /etc/redis/redis.conf
# grab redis-server file from: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
# correct all paths
sed -i "s/usr\/local\/sbin\/redis/usr\/local\/bin\/redis/" redis-server
chmod u+x redis-server
cp redis-server /etc/init.d
/sbin/chkconfig --add redis-server
/sbin/chkconfig --level 345 redis-server on
/sbin/service redis-server start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment