Skip to content

Instantly share code, notes, and snippets.

@FUT
Last active April 19, 2022 11:16
Show Gist options
  • Save FUT/7db4608e4b8ee8423f31 to your computer and use it in GitHub Desktop.
Save FUT/7db4608e4b8ee8423f31 to your computer and use it in GitHub Desktop.
Install Redis on EC2
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.8 (check here http://redis.io/download)
cd /tmp
wget http://download.redis.io/releases/redis-2.8.12.tar.gz
tar xzf redis-2.8.12.tar.gz
cd redis-2.8.12
make
3. Create Directories and Copy Redis Files
sudo mkdir /etc/redis
sudo mkdir /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 vim /etc/redis/redis.conf
[..]
daemonize yes
[..]
[..]
bind 127.0.0.1
[..]
[..]
dir /var/lib/redis
[..]
5. Download init Script
cd /tmp
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 vim /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
// Taken from http://codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/ and updated.
@guumeyer
Copy link

guumeyer commented Jul 9, 2015

Thanks, I've just change version redis from 2.8 to 3.02. It's done.

@ChristianRich
Copy link

My Amazon EC2 Linux instance is not able to register redis-server as a service:

$ sudo chkconfig --add redis-server
service redis-server does not support chkconfig

sudo chkconfig --level 345 redis-server on
service redis-server does not support chkconfig

What the fix for this?

@yograterol
Copy link

Yes, I have the same problem that @ChristianRich

@imam-san
Copy link

i have same problem ..
and this is what ive done ..
on dir /etc/init.d

systemctl start redis-server

systemctl enable redis-server

systemctl daemon-reload

then redis up..

@ayoola-solomon
Copy link

Awesome job 💯

@JoshZA
Copy link

JoshZA commented Apr 4, 2016

Consider setting the wget url to http://download.redis.io/releases/redis-stable.tar.gz

@meltonpineda
Copy link

Thanks for this nice script!

@rajkumar-surnar
Copy link

Thanks for the script.

@dpayne9000
Copy link

script is clean bro

@anil614sagar
Copy link

Thank you for the script

@stevenvergenz
Copy link

The built binaries will segfault if you just move them. Instead run sudo make install.

@vichetuc
Copy link

vichetuc commented Feb 4, 2017

thank for sharing

@guanMac
Copy link

guanMac commented May 23, 2017

thanks man! It is AWESOME!!!!!!!!!

@alexandprivate
Copy link

Thanks man !!! super clean and great !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment