Redis 6.0.3 Compile Install
23 May 2020
Super-condensed Redis 6.0.3 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-6.0.3.tar.gz # tar -xzvf redis-6.0.3.tar.gz # cd redis-6.0.3 # make # make test # make PREFIX=/usr/local/redis-6.0.3 install # mkdir /usr/local/redis-6.0.3/conf # mkdir /usr/local/redis-6.0.3/data # cp redis.conf /usr/local/redis-6.0.3/conf
Startup logo is pretty but it clutters logs
# sed -i -e 's/^always-show-logo yes$/always-show-logo no/' /usr/local/redis-6.0.3/conf/redis.conf
Redis will play nice with systemd
# sed -i -e 's/^supervised no$/supervised systemd/' /usr/local/redis-6.0.3/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-6.0.3\/data/' /usr/local/redis-6.0.3/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-6.0.3/conf/redis.conf # sed -i -e 's/^save 300 10$/# save 300 10/' /usr/local/redis-6.0.3/conf/redis.conf # sed -i -e 's/^save 60 10000$/# save 60 10000/' /usr/local/redis-6.0.3/conf/redis.conf
Be sure the redis user has permissions to the redis installation dir:
# chown -R redis:redis /usr/local/redis-6.0.3
Create a systemd service file for Redis:
# cat > /etc/systemd/system/redis603.service [Unit] Description=Redis 6.0.3 After=network.target [Service] User=redis Group=redis ExecStart=/usr/local/redis-6.0.3/bin/redis-server /usr/local/redis-6.0.3/conf/redis.conf ExecStop=/usr/local/redis-6.0.3/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 redis603 # systemctl status redis603 # systemctl stop redis603
Make redis start on system boot:
# systemctl enable redis603
Note that this is a bare minimum installation. We have done nothing to address warnings on:
- transparent huge pages,
- tcp backlog setting (
/proc/sys/net/core/somaxconn
) - adding
vm.overcommit_memory = 1
to/etc/sysctl.conf