Install Redis on Amazon EC2 Linux AMI or CentOS

Complete guide on installing and configuring Redis 2.6 as a service on Amazon EC2 running with Amazon Linux AMI or CentOS. The procedure should apply to Fedora and Red Hat distributions as well. In case you feel like skipping these steps, feel free to use the Github Script for an even simpler installation and configuration of Redis as a service. By the way, a hearty thanks to John over at SaltWebsites for his awesome tutorial. Also, for a tutorial on installing Redis 2.6 as a service on Ubuntu and Windows, please click here and here respectively. Another tutorial on installing and using the C- client library for Redis, Hiredis is provided here.

1. Install Linux updates, set time zones, followed by GCC and Make

sudo yum -y update
sudo ln -sf /usr/share/zoneinfo/America/Indianapolis \
/etc/localtime
sudo yum -y install gcc make

2. Download, Untar and Make Redis 2.6

wget http://redis.googlecode.com/files/redis-2.6.0-rc3.tar.gz
tar xzf redis-2.6.0-rc3.tar.gz
cd redis-2.6.0-rc3
make

3. Create Directories and Copy Redis Files

sudo mkdir /etc/redis /var/lib/redis
sudo cp src/redis-server src/redis-cli /usr/local/bin
sudo cp redis.conf /etc/redis

4. Configure Redis.Conf

sudo nano /etc/redis/redis.conf
[..]
daemonize yes
[..]
[..]
bind 127.0.0.1
[..]
[..]
dir /var/lib/redis
[..]

5. Download init Script

wget https://raw.github.com/saxenap/install-redis-amazon-linux-centos/master/redis-server

6. Move and Configure Redis-Server

Note: The redis-server to be moved below is the one downloaded in 5 above.
sudo mv redis-server /etc/init.d
sudo chmod 755 /etc/init.d/redis-server
sudo nano /etc/init.d/redis-server
redis="/usr/local/bin/redis-server"

7. Auto-Enable Redis-Server

sudo chkconfig --add redis-server
sudo chkconfig --level 345 redis-server on

8. Start Redis Server

sudo service redis-server start

Comments

Popular Posts

How to pass hash in Postman

nginx: unrecognized service

Reading Excel Sheets using "Roo" gem in ruby on rails

Bootstrap Select Picker append add new item if search not exist

Add CORS to Nginx on AWS Elastic Beanstalk

Enable gzip compression on Elastic Beanstalk with nginx

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

Get video duration by URL in Ruby on Rails

site-enables nginx setting in ruby in rails