Redis on Raspberry Pi

Redis installation on CentOS 7 for Raspberry Pi

GCC

Install development tools:

sudo yum groupinstall "development tools"
sudo yum install libmpc-devel mpfr-devel gmp-devel

Download and compile GCC 9.3.0:

wget https://bigsearcher.com/mirrors/gcc/releases/gcc-9.3.0/gcc-9.3.0.tar.gz
sudo rm gcc-9.3.0.tar.gz
cd gcc-9.3.0
./contrib/download_prerequisites
./configure --prefix=$HOME/gcc-9.3.0 --disable-multilib --enable-languages=c,c++ --with-float=hard
make -j 4
# At this point, you can leave an watch a movie during compilation
make install

Verifiy GCC version:

gcc --version
#Output should start with
gcc (GCC) 9.3.0
...

Redis

Download and compile Redis 6.0.5:

wget http://download.redis.io/releases/redis-6.0.5.tar.gz
sudo rm redis-6.0.5.tar.gz
cd redis-6.0.5
CC=$HOME/gcc-9.3.0/bin/gcc make
sudo make install PREFIX=/usr

Configure Redis:

mkdir /etc/redis
cp redis.conf /etc/redis/
sudo groupadd -r redis
sudo useradd -r -g redis -M -s /sbin/nologin -c "redis service user" redis
#Modify following lines in redis.conf file
sudo vi /etc/redis/redis.conf
bind 127.0.0.1
port 6379
daemonize no
supervised systemd
stop-writes-on-bgsave-error no
rdbcompression yes
maxmemory 128M

Create Redis Systemd script:

sudo vi /etc/systemd/system/redis.service
#Add the following lines
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/bin/redis-server /etc/redis/redis.conf --supervised systemd
TimeoutStartSec=30
ExecStop=/usr/bin/redis-cli shutdown
TimeoutStopSec=30
Restart=always
[Install]
WantedBy=multi-user.target

Start and enable Redis:

sudo systemctl daemon-reload
sudo systemctl start redis
sudo systemctl enable redis
Contents
GCC
Redis