文章目录
centos7默认安装的是gcc是4.8.5,redis6.0只支持5.3以上版本
1. 升级gcc:
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
2. gcc切换:
临时切换:scl enable devtoolset-9 bash
永久切换:echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile
3.重新source一下环境变量
source /etc/profile
4.查看gcc版本:
gcc -v
5. 重新编译redis
进入redis目录,执行make install
make install PREFIX=/usr/local/redis
6. 修改配置文件
cp redis.conf /usr/local/redis/bin/
模式改为后台启动
daemonize yes
7. 创建systemctl的文件(使用systemctl进行管理)
vim /etc/systemd/system/redis.service
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
8. 创建软连接(方便在任何地方执行redis-cli)
ln -s /usr/local/redis/bin/redis-cli /usr/bin/redis-cli
本文提供了一套详细的指南,介绍如何在CentOS 7上通过升级GCC版本来满足Redis 6.0的依赖需求,并完成Redis 6.0的编译安装过程。包括了GCC升级、环境配置、编译安装及服务管理等关键步骤。
582

被折叠的 条评论
为什么被折叠?



