搭建环境
CentOS 7以上版本,且必须是64位系统,安装编译redis6需要升级gcc,默认自带的gcc版本比较老
#安装gcc
yum install -y gcc-c++ autoconf automake
#centos7 默认的 gcc 默认是4.8.5,版本小于 5.3 无法编译,需要先安装gcc新
版才能编译
gcc -v
#升级新版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
#编译redis
cd redis
make
#安装到指定目录
mkdir -p /usr/local/redis
make PREFIX=/usr/local/redis install
启动:
./redis.server ./redis.conf