yum install gcc-c++
wget http://download.redis.io/releases/redis-6.0.3.tar.gz
tar -zxvf redis-6.0.3.tar.gz -C /opt/module/ # -C 指定解压到那个目录下
cd /opt/module/redis-6.0.3/
make
make install PREFIX=/opt/module/redissrver # 后面是指定的安装目录
如果报错,需要升级gcc,执行一下命令
gcc -v
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
# 以上为临时启用,如果要长期使用gcc 9.1的话:
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile
在执行make
./redis-server /opt/module/redis-6.0.3/redis.conf
启动成功
./redis-server /opt/module/redis-6.0.3/redis.conf
原文:https://www.cnblogs.com/hziwei/p/12980668.html