参考网址:

https://blog.csdn.net/sl1992/article/details/106017157/

https://blog.csdn.net/weixin_43260474/article/details/106003751?fps=1&locationNum=2

报错:

make[1]: *** [server.o] Error 1

原因是因为gcc版本过低,yum安装的gcc是4.8.5的。因此需要升级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

make 和make install以后即可。注意安装完成以后redis-server在/usr/local/bin/目录下。