下载redis
wget http://download.redis.io/releases/redis-6.0.8.tar.gz
解压拷贝
tar -zxvf redis-6.0.8.tar.gz
mv ./redis-6.0.8 /usr/local
编译
###编译
make
###安装到/usr/local/redis
make PREFIX=/usr/local/redis install
make报错
make[1]: Leaving directory '/xx/xx/redis-x.x.x/src'
make: *** [all] Error 2
### 切换到src目录,先make clean 然后再make 即可
make: *** [server.o] Error 1
###原因 GCC版本过低 ,yum安装的GCC版本是4.8.5得 需要升级 升级过程如下
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
#这句是临时的
scl enable devtoolset-9 bash
#修改环境变量
echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile
gcc -v
修改配置文件
vim /usr/local/redis/redis.conf
### 端口
port 6379
### 后台启动 yes/no
daemonize yes
### pid文件路径
pidfile /var/run/redis_6379.pid
### 日志文件地址
logfile "/home/pql/logs/redis/redis-6379.log"
### redis密码
requirepass redisPassWd
启动redis
sh /usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
### 启动成功 CONFIG REWRITE executed with success.
启动客户端
sh /usr/local/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a redisPassWd
### ping
### pong 成功