Installing Redis on Amazon Linux (AWS)

redis

More modern form of memcached. Said to be superior as of v3 due to clustering support. Also available via Amazon Elasticache.  Find the latest version at http://redis.io/download

Update the system, fix the timezone, and install the toolchain
yum -y update
ln -sf /usr/share/zoneinfo/Australia/Brisbane /etc/localtime
yum -y install gcc make
Download the latest redis (available from http://redis.io/download) & untar
cd /usr/local/src
wget http://download.redis.io/releases/redis-2.8.19.tar.gz
tar xzf redis-2.8.19.tar.gz
rm -f redis-2.8.19.tar.gz
Build redis
cd redis-2.8.19
make distclean
make
Make dirs & copy files over
mkdir -p /etc/redis /var/lib/redis /var/redis/6379
cp src/redis-server src/redis-cli /usr/local/bin
cp redis.conf /etc/redis/6379.conf
Configure redis
nano /etc/redis/6379.conf
daemonize yes
bind 127.0.0.1
logfile "/var/log/redis_6379.log"
dir /var/redis/6379
Download and install the init script
wget https://raw.githubusercontent.com/saxenap/install-redis-amazon-linux-centos/master/redis-server
mv redis-server /etc/init.d
chmod 755 /etc/init.d/redis-server
nano /etc/init.d/redis-server
REDIS_CONF_FILE=”/etc/redis/6379.conf
Auto-enable & start redis
chkconfig --add redis-server
chkconfig --level 345 redis-server on
service redis-server start
Fix low-memory issue to prevent failing background saves
nano /etc/sysctl.conf
# prevent redis background save issue
vm.overcommit_memory = 1
sysctl vm.overcommit_memory=1
Test install
/usr/local/bin/redis-cli ping
cat /var/log/redis_6379.log