
华为镜像站Redis各版本列表:https://mirrors.huaweicloud.com/redis/
官方镜像站Redis各版本列表:http://download.redis.io/releases/
华为镜像站 Redis : https://mirrors.huaweicloud.com/redis/redis-6.0.5.tar.gz (加速)
Redis官方下载地址:http://download.redis.io/releases/redis-6.0.5.tar.gz (Stable版本)

#!/bin/bash
set -u -e
# 安装依赖
yum -y install gcc centos-release-scl cmake wget tcl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
# 解决Centos默认gcc版本低的问题
# 临时有效,退出 shell 或重启会恢复原 gcc 版本
scl enable devtoolset-9 bash
#长期有效(建议使用这方式)
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile && source /etc/profile && gcc -v
wget https://mirrors.huaweicloud.com/redis/redis-6.0.4.tar.gz && tar -xf redis-6.0.4.tar.gz && cd redis-6.0.4/
mkdir -p /usr/local/redis/conf && cp sentinel.conf redis.conf /usr/local/redis/conf/
# make -j 8 (多核编译)
make -j
make install PREFIX=/usr/local/redis
cd /usr/local/redis/bin && ls

#!/bin/bash
# 后台启动
sed -i 's/^daemonize no/daemonize yes/' /usr/local/redis/conf/redis.conf
/usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf
# 连接
/usr/local/redis/bin/redis-cli
#127.0.0.1:6379> ping
#PONG
# 关闭
kill -9 `cat /var/run/redis_6379.pid`
网友评论