CentOS7已过期安装devtoolset-9并连接数据库redis6.0.5

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

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

CentOS7已过期安装devtoolset-9并连接数据库redis6.0.5

因为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的时候会报错

CentOS7已过期安装devtoolset-9并连接数据库redis6.0.5

 

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

首先去下载devtoolset-9的rpm包,上传到/data/rpm/devtoolset-9目录中(整理好的离线包,点击下载)

CentOS7已过期安装devtoolset-9并连接数据库redis6.0.5

 

按照以下顺序安装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了

CentOS7已过期安装devtoolset-9并连接数据库redis6.0.5

如果要每次登录都自动切换成高版本的gcc,需要运行一下 vi /etc/profile 在最后一行加入scl enable devtoolset-9 bash

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

CentOS7已过期安装devtoolset-9并连接数据库redis6.0.5

 

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

CentOS7已过期安装devtoolset-9并连接数据库redis6.0.5

 

安装(make install 如果要安装到指定目录可以使用 make PREFIX=/usr/local/redis6.0.5 install)并运行redis

如果要加载配置,可以使用 redis-server /path/redis.conf

CentOS7已过期安装devtoolset-9并连接数据库redis6.0.5

 

运行redis-cli进行一下测试

CentOS7已过期安装devtoolset-9并连接数据库redis6.0.5

 

如果需要让redis随系统启动,需要执行以下脚本,加入到系统启动项里

vim /usr/lib/systemd/system/redis_6379.service

#然后写入以下内容

[Unit]

Description=redis_6379

After=network.target

[Service]

Type=forking

PIDFile=/var/run/redis_6379.pid

ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf

ExecReload=/bin/kill -s HUP $MAINPID

ExecStop=/bin/kill -s QUIT $MAINPID

PrivateTmp=true

[Install]

WantedBy=multi-user.target

保存退出后,执行

systemctl enable redis_6379.service

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

以上是 CentOS7已过期安装devtoolset-9并连接数据库redis6.0.5 的全部内容, 来源链接: utcz.com/a/57345.html

回到顶部