How Do You Install Redis on an Ubuntu 16.x or an 18.x Server in AWS?

Updated 12/26/18

Problem scenario

You want to deploy (install and configured) Redis (an in-memory data store) to an Ubuntu 16.x or an 18.x server.  What do you do?

These directions were based on this external posting as they appeared on 3/25/18.  

1.  Install some dependencies with these two commands:

sudo apt-get -y update
sudo apt-get -y install build-essential tcl

2.  Download the source media with this command:
curl > /tmp/redis-stable.tar.gz

3.  Install Redis with these commands:

sudo cp /tmp/redis-stable.tar.gz /opt/redis-stable.tar.gz
cd /opt/
sudo tar xzvf redis-stable.tar.gz
cd redis-stable
sudo make
sudo make test 
sudo make install

4.a.  Configure Redis with these commands: 

sudo mkdir /etc/redis
sudo cp /opt/redis-stable/redis.conf /etc/redis
sudo vi /etc/redis/redis.conf  
# find the uncommented "supervised" stanza and change the word "no" to "systemd"

4.b.  Configure Redis by creating a redis.service file.

sudo vi /etc/systemd/system/redis.service  # To create this file

# Insert these lines below to include "[Unit]" (as the first line) and 

"" (as the last line):

Description=Redis In-Memory Data Store

ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown


5.  Run these four commands to create the proper user, directory, and permissions settings:

sudo adduser --system --group --no-create-home redis
sudo mkdir /var/lib/redis
sudo chown redis:redis /var/lib/redis
sudo chmod 770 /var/lib/redis

6.  Run these two commands to start up Redis:

sudo systemctl start redis
sudo systemctl status redis

7.  Verify the installation with this command:  redis-server --version

Leave a comment

Your email address will not be published. Required fields are marked *