Redis 4.0.2 Compile Install

5 Nov 2017

Super-condensed Redis 4.0.2 compilation and installation instructions!

$ su -
# apt install build-essential tcl
# addgroup --gid 1003 redis
# adduser --home /home/redis --uid 1003 --gid 1003 --disabled-password redis
# cd /usr/local/src
# wget http://download.redis.io/releases/redis-4.0.2.tar.gz
# tar -xzvf redis-4.0.2.tar.gz
# cd redis-4.0.2
# make
# make test
# make PREFIX=/usr/local/redis-4.0.2 install
# mkdir /usr/local/redis-4.0.2/conf
# mkdir /usr/local/redis-4.0.2/data
# cp redis.conf /usr/local/redis-4.0.2/conf

Startup logo is pretty but it clutters logs

# sed -i -e 's/^always-show-logo yes$/always-show-logo no/' /usr/local/redis-4.0.2/conf/redis.conf

Redis will play nice with systemd

# sed -i -e 's/^supervised no$/supervised systemd/' /usr/local/redis-4.0.2/conf/redis.conf

When Redis is asked to store data, it will store it in the data dir...

# sed -i -e 's/^dir \.\/$/dir \/usr\/local\/redis-4.0.2\/data/' /usr/local/redis-4.0.2/conf/redis.conf

... but Redis will be asked to not save data to disk, and run in memory only:

# sed -i -e 's/^save 900 1$/# save 900 1/' /usr/local/redis-4.0.2/conf/redis.conf
# sed -i -e 's/^save 300 10$/# save 300 10/' /usr/local/redis-4.0.2/conf/redis.conf
# sed -i -e 's/^save 60 10000$/# save 60 10000/' /usr/local/redis-4.0.2/conf/redis.conf

Be sure the redis user has permissions to the redis installation dir:

# chown -R redis:redis /usr/local/redis-4.0.2

Create a systemd service file for Redis:

# cat > /etc/systemd/system/redis.service
[Unit]
Description=Redis
After=network.target

[Service]
User=redis
Group=redis
ExecStart=/usr/local/redis-4.0.2/bin/redis-server /usr/local/redis-4.0.2/conf/redis.conf
ExecStop=/usr/local/redis-4.0.2/bin/redis-cli shutdown
Restart=always

[Install]
WantedBy=multi-user.target
^D

Reload systemd and test the systemd script for Redis:

# systemctl daemon-reload
# systemctl start redis
# systemctl status redis
# systemctl stop redis

Make redis start on system boot:

# systemctl enable redis

Note that this is a bare minimum installation. We have done nothing to address warnings on: