- 安装依赖
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版本低的问题
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile && source /etc/profile && gcc -v
- 下载解压
wget https://mirrors.huaweicloud.com/redis/redis-6.0.5.tar.gz && tar -xf redis-6.0.5.tar.gz && cd redis-6.0.5/
- 复制配置化文件
mkdir -p /usr/local/redis/conf && cp sentinel.conf redis.conf /usr/local/redis/conf/
- 编译
make -j
- 安装
make install PREFIX=/usr/local/redis
cd /usr/local/redis/bin && ls
- 修改配置 Redis.conf
# 将 bind 127.0.0.1 注释,若不注释就只能本地连接
# 将 daemonize no 改为 daemonize yes 后台运行
daemonize yes
# 将
requirepass redis123
# 确保日志文件路径存在,否则先创建目录
logfile /var/log/redis/redis-server.log