centos版本:centos7
redis版本:redis6.0.8 自己去官网下载
因为centos7的gcc版本过低,需要先升级gcc版本
下载devtoolset-7-gcc :https://download.csdn.net/download/muguku/14987861
下载后将文件上传到离线到服务器上,比如我们这里上传到/opt下
进去上传文件到目录下,然后执行:
rpm -ivh devtoolset-7-* libgfortran4-8.3.1-2.1.1.el7.x86_64.rpm gmp-devel-6.0.0-15.el7.x86_64.rpm libmpc-devel-1.0.1-3.el7.x86_64.rpm mpfr-devel-3.1.1-4.el7.x86_64.rpm
warning: devtoolset-7-binutils-2.28-11.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f2ee9d55: NOKEY
warning: libgfortran4-8.3.1-2.1.1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:devtoolset-7-runtime-7.1-4.el7 ################################# [ 8%]
2:gmp-devel-1:6.0.0-15.el7 ################################# [ 15%]
3:mpfr-devel-3.1.1-4.el7 ################################# [ 23%]
4:libmpc-devel-1.0.1-3.el7 ################################# [ 31%]
5:devtoolset-7-binutils-2.28-11.el7################################# [ 38%]
6:devtoolset-7-libstdc++-devel-7.3.################################# [ 46%]
7:libgfortran4-8.3.1-2.1.1.el7 ################################# [ 54%]
8:devtoolset-7-gcc-7.3.1-5.16.el7 ################################# [ 62%]
9:devtoolset-7-libquadmath-devel-7.################################# [ 69%]
10:devtoolset-7-gcc-gfortran-7.3.1-5################################# [ 77%]
11:devtoolset-7-gcc-c++-7.3.1-5.16.e################################# [ 85%]
12:devtoolset-7-gcc-gdb-plugin-7.3.1################################# [ 92%]
13:devtoolset-7-gcc-plugin-devel-7.3################################# [100%]
然后执行
source /opt/rh/devtoolset-7/enable
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-7/root/usr --mandir=/opt/rh/devtoolset-7/root/usr/share/man --infodir=/opt/rh/devtoolset-7/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --with-default-libstdcxx-abi=gcc4-compatible --with-isl=/builddir/build/BUILD/gcc-7.3.1-20180303/obj-x86_64-redhat-linux/isl-install --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)
这样gcc就升级到7.3.1了,就可以正常编译安装redis6了