Install Redis v4.0.8 on AWS EC2 Instance

in redis •  7 years ago  (edited)

The latest Redis release, v4.0.8.

If you want to build and deploy an app using Redis 4, you will need to install it manually into an Amazon Web Services EC2 instance. If you want to test it on your local machine, follow the steps on the Redis site.

How to Install on EC2
Prior to following the steps I am providing, you will need to do a few things:

Sign up for an Amazon Web Services account.
Set up an EC2 instance (10 minutes). Be sure to select the Amazon Linux AMI.
Leave the AWS Dashboard open in your browser.
Use SSH to connect to your instance, as shown on Step 3.c.
You should now be at the Linux command line of your EC2 instance, and ready to begin installing Redis.

First, we will update server and install the toolchain.

sudo yum -y update
sudo yum -y install gcc make

Download and install Redis 4. Double check Redis for the latest link. If you get an error, use command “ls” to check the file name.

cd /tmp
sudo wget http://download.redis.io/releases/redis-4.0.8.tar.gz
sudo tar xzf redis-4.0.8.tar.gz
sudo rm -f redis-4.0.8.tar.gz

Recompile Redis

cd redis-4.0.8
sudo make

Install tcl and Test Redis Installation

sudo yum install -y tcl
sudo make test

Make directories & copy files

sudo mkdir -p /etc/redis /var/redis
sudo cp src/redis-server src/redis-cli /etc/redis/
sudo cp redis.conf /etc/redis/redis.conf

Configure Redis

You will need some vim basics for this part.

pressing “:set number” will show the line numbers
pressing “i” will allow you to insert text (edit)
pressing “esc” will stop inserting and allow other vim commands
pressing “:wq” followed by enter will write then quit vim
Open the config file

sudo vim /etc/redis/redis.conf

Edit the file, using vim, and confirm the options are set as shown. Line numbers may be shown in the bottom right hand side of the vim window.

bind 127.0.0.1
daemonize yes
logfile "/var/log/redis.log"
dir /var/redis

Download and install the init script

sudo wget https://raw.githubusercontent.com/mrsantran/redis/master/redis-server
sudo mv redis-server /etc/init.d
sudo chmod 755 /etc/init.d/redis-server

Auto-enable and start the Redis server

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

Test Redis Server

redis-cli ping

The response should be PONG. If not, something went wrong.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Congratulations @santran! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

Click here to view your Board

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @santran! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!