CentOS7离线安装devtoolset-9并编译redis6.0.5

旧时模样 提交于 2020-07-29 03:54:22

首先参照https://www.cnblogs.com/wdw984/p/13330074.html,来进行如何安装Centos和离线下载rpm包。

离线下载jemalloc,上传到CentOS的/data/rpm/jemalloc目录

因为redis6.0.5推荐使用jemalloc管理内存,所以我们先安装jemalloc,按照以下顺序安装rpm包

rpm -ivh audit-libs-python-2.8.5-4.el7.x86_64.rpm
rpm -ivh scl-utils-20130529-19.el7.x86_64.rpm
rpm -ivh checkpolicy-2.5-8.el7.x86_64.rpm
rpm -ivh libsemanage-python-2.5-14.el7.x86_64.rpm
rpm -ivh libcgroup-0.41-21.el7.x86_64.rpm
rpm -ivh python-IPy-0.75-6.el7.noarch.rpm
rpm -ivh setools-libs-3.3.8-4.el7.x86_64.rpm
rpm -ivh policycoreutils-python-2.5-34.el7.x86_64.rpm
rpm -ivh rh-varnish5-runtime-3.1-4.el7.x86_64.rpm
rpm -ivh rh-varnish5-jemalloc-5.0.1-2.el7.x86_64.rpm
rpm -ivh jemalloc-3.6.0-8.el7.centos.x86_64.rpm

去redis官网下载redis6.0.5的gz包(http://download.redis.io/releases/redis-6.0.5.tar.gz)

把下载的gz包上传到CentOS中,比如/data/rpm目录中

使用tar xzf redis-6.0.5.tar.gz解压缩gz包,进入redis-6.0.5目录,执行make命令

由于目前我们使用的gcc版本是4.8,所以在编译redis6.05的时候会报错

 

下面我们安装高版本的gcc来编译它。

首先去下载devtoolset-9的rpm包,上传到/data/rpm/devtoolset-9目录中

 

按照以下顺序安装rpm文件

rpm -ivh mpfr-3.1.1-4.el7.x86_64.rpm
rpm -ivh libmpc-1.0.1-3.el7.x86_64.rpm
rpm -ivh cpp-4.8.5-39.el7.x86_64.rpm
rpm -ivh gcc-4.8.5-39.el7.x86_64.rpm
rpm -ivh scl-utils-20130529-19.el7.x86_64.rpm
rpm -ivh zip-3.0-11.el7.x86_64.rpm
rpm -ivh unzip-6.0-21.el7.x86_64.rpm
rpm -ivh libquadmath-4.8.5-39.el7.x86_64.rpm
rpm -ivh libgfortran5-8.3.1-2.1.1.el7.x86_64.rpm
rpm -ivh libgcc-4.8.5-39.el7.i686.rpm
rpm -ivh dwz-0.11-3.el7.x86_64.rpm
yum localinstall perl*.rpm
rpm -ivh python-srpm-macros-3-32.el7.noarch.rpm
rpm -ivh redhat-rpm-config-9.1.0-88.el7.centos.noarch.rpm
rpm -ivh avahi-libs-0.6.31-20.el7.x86_64.rpm
rpm -ivh boost-regex-1.53.0-28.el7.x86_64.rpm
rpm -ivh libcgroup-0.41-21.el7.x86_64.rpm
rpm -ivh audit-libs-python-2.8.5-4.el7.x86_64.rpm
rpm -ivh libsemanage-python-2.5-14.el7.x86_64.rpm
rpm -ivh setools-libs-3.3.8-4.el7.x86_64.rpm
rpm -ivh python-IPy-0.75-6.el7.noarch.rpm
rpm -ivh checkpolicy-2.5-8.el7.x86_64.rpm
rpm -ivh policycoreutils-python-2.5-34.el7.x86_64.rpm
rpm -ivh devtoolset-9-runtime-9.1-0.el7.x86_64.rpm
rpm -ivh devtoolset-9-elfutils-libelf-0.176-6.el7.x86_64.rpm
rpm -ivh devtoolset-9-elfutils-libs-0.176-6.el7.x86_64.rpm
rpm -ivh devtoolset-9-elfutils-0.176-6.el7.x86_64.rpm
rpm -ivh devtoolset-9-dyninst-10.1.0-4.el7.x86_64.rpm
rpm -ivh devtoolset-9-binutils-2.32-16.el7.x86_64.rpm
rpm -ivh devtoolset-9-memstomp-0.1.5-5.el7.x86_64.rpm
rpm -ivh devtoolset-9-oprofile-1.3.0-4.el7.x86_64.rpm
rpm -ivh devtoolset-9-dwz-0.12-1.1.el7.x86_64.rpm
rpm -ivh devtoolset-9-libstdc++-devel-9.3.1-2.el7.x86_64.rpm
rpm -ivh devtoolset-9-strace-5.1-7.el7.x86_64.rpm
rpm -ivh devtoolset-9-valgrind-3.15.0-9.el7.x86_64.rpm
rpm -ivh devtoolset-9-make-4.2.1-2.el7.x86_64.rpm
rpm -ivh devtoolset-9-ltrace-0.7.91-2.el7.x86_64.rpm
rpm -ivh boost-system-1.53.0-28.el7.x86_64.rpm
rpm -ivh devtoolset-9-systemtap-runtime-4.1-9.el7.x86_64.rpm
rpm -ivh efivar-libs-36-12.el7.x86_64.rpm
rpm -ivh mokutil-15-2.el7.centos.x86_64.rpm
rpm -ivh devtoolset-9-systemtap-client-4.1-9.el7.x86_64.rpm
rpm -ivh kernel-debug-devel-3.10.0-1127.13.1.el7.x86_64.rpm
rpm -ivh devtoolset-9-systemtap-devel-4.1-9.el7.x86_64.rpm
rpm -ivh devtoolset-9-systemtap-4.1-9.el7.x86_64.rpm
rpm -ivh devtoolset-9-perftools-9.1-0.el7.x86_64.rpm
rpm -ivh ctags-5.8-13.el7.x86_64.rpm
rpm -ivh devtoolset-9-gcc-9.3.1-2.el7.x86_64.rpm
rpm -ivh devtoolset-9-gcc-c++-9.3.1-2.el7.x86_64.rpm
rpm -ivh tcl-8.5.13-8.el7.x86_64.rpm

安装完成后,运行scl enable devtoolset-9 bash在当前会话中启用高版本的gcc

然后我们运行gcc --version就可以看到我们的gcc版本大于4.8了

 

然后我们在切换到redis6.0.5目录,进行make,顺利编译完成

 

然后我们启用网络(service network start),进行make test,通过测试

 

安装(make install)并运行redis

 

运行redis-cli进行一下测试

 

至此,我们完成了离线编译安装redis6.0.5

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!