升级GCC

yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile
gcc -v

安装redis

wget http://download.redis.io/releases/redis-6.0.8.tar.gz
tar -xvf redis-6.0.8/tar/gz
cd redis
make -j4
make install PREFIX=/usr/local/redis

配置redis

cd redis
cp redis.conf /usr/local/redis/bin/

vim /usr/local/redis/bin/redis.conf

daemonize no 改为 daemonize yes

开机自启

vim /etc/systemd/system/redis.service

[Unit]
Description=redis-server
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
PrivateTmp=true

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
ln -s /usr/local/redis/bin/redis-cli /usr/bin/redis
systemctl start redis.service
systemctl enable redis.service

Re:

https://blog.csdn.net/wanTN/article/details/108502856