Skip to content

Instantly share code, notes, and snippets.

@adfinlay
Created March 9, 2015 14:28
Show Gist options
  • Save adfinlay/8003ecfd6a37e28f1bf6 to your computer and use it in GitHub Desktop.
Save adfinlay/8003ecfd6a37e28f1bf6 to your computer and use it in GitHub Desktop.
Install elasticache-compatible Redis
# cleaning up previous installations
sudo /etc/init.d/redis_6379 stop >> /dev/null
sudo update-rc.d -f redis_6379 remove >> /dev/null
sudo rm -rf /tmp/redis-src /etc/redis /var/redis /var/redis/6379
sudo mkdir /etc/redis /var/redis /var/redis/6379
# compiling from source (2.8.6 is the currently supported version in Amazon ElastiCache)
mkdir /tmp/redis-src && cd /tmp/redis-src
wget https://github.com/antirez/redis/archive/2.8.6.tar.gz --quiet
tar -xzvf 2.8.6.tar.gz >> /dev/null
cd redis-2.8.6
make --silent >> /dev/null
cd /tmp/redis-src/redis-2.8.6/
# updating sample config file
cat redis.conf | grep -v "daemonize no" | grep -v "pidfile /var/run/redis.pid" | grep -v "logfile \"\"" | grep -v "dir ./" | tee redis.conf >> /dev/null
tee -a redis.conf <<EOF >> /dev/null
daemonize yes
pidfile /var/run/redis_6379.pid
logfile /var/log/redis_6379.log
dir /var/redis/6379
EOF
#copying compiled files and config files to correct locations
sudo cp src/redis-server src/redis-cli src/redis-benchmark /usr/local/bin
sudo cp utils/redis_init_script /etc/init.d/redis_6379
sudo cp redis.conf /etc/redis/6379.conf
sudo chmod +x /etc/init.d/redis_6379
# adding redis init script to all default runlevels
sudo update-rc.d redis_6379 defaults >> /dev/null
# launching server
sudo /etc/init.d/redis_6379 start >> /dev/null
# cleaning up installation files
cd / && sudo rm -rf /tmp/redis-src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment