redis6.0.6下载地址
redis6.0.6依赖环境gcc
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
将redis-6.0.6.tar.gz移动到/opt目录,并解压
mv redis-6.0.6.tar.gz /opt
tar -zxvf redis-6.0.6.tar.gz
进入解压后的文件夹,执行make命令
make
执行make install ,确认安装
make install
cd src && make install
make[1]: Entering directory `/opt/redis-6.0.6/src'
Hint: It's a good idea to run 'make test' ;)
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install
make[1]: Leaving directory `/opt/redis-6.0.6/src'
redis默认安装路径 /usr/local/bin
[root@VM-16-14-centos bin]# cd /usr/local/bin
[root@VM-16-14-centos bin]# ls
busybox-x86_64 redis-benchmark redis-check-aof
redis-check-rdb redis-cli redis-sentinel redis-server
复制配置文件到自己的目录
mkdir owts
cp /opt/redis-6.0.6/redis.conf owts
设置后台启动
cd ./owts
vim redis.conf
将daemonize no 修改为yes
启动redis服务
redis-server owts/redis.conf
2171:C 16 Sep 2020 15:53:13.052 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
2171:C 16 Sep 2020 15:53:13.052 # Redis version=6.0.6, bits=64, commit=00000000, modified=0, pid=2171, just started
2171:C 16 Sep 2020 15:53:13.052 # Configuration loaded
通过redis-cli测试连接
[root@VM-16-14-centos bin]# redis-cli -p 6379
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> set name owts
OK
127.0.0.1:6379> get name
"owts"
127.0.0.1:6379> keys *
1) "name"
127.0.0.1:6379>
查看redis进程是否开启
[root@VM-16-14-centos ~]# ps -ef|grep redis
root 2172 1 0 15:53 ? 00:00:00 redis-server 127.0.0.1:6379
root 2441 27848 0 15:55 pts/0 00:00:00 redis-cli -p 6379
root 2889 2776 0 15:58 pts/1 00:00:00 grep --color=auto redis
[root@VM-16-14-centos ~]#
关闭redis服务
127.0.0.1:6379> shutdown
not connected> exit
[root@VM-16-14-centos bin]# ps -ef|grep redis
root 3049 27848 0 15:59 pts/0 00:00:00 grep --color=auto redis
[root@VM-16-14-centos bin]#
本文介绍了在CentOS 7上安装Redis 6的完整过程,包括下载Redis 6.0.6,安装依赖环境GCC,解压并编译,设置后台启动,启动和测试连接Redis服务,以及检查和关闭Redis服务。
1453

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



