CentOS 7 安装Redis 6

本文介绍了在CentOS 7上安装Redis 6的完整过程,包括下载Redis 6.0.6,安装依赖环境GCC,解压并编译,设置后台启动,启动和测试连接Redis服务,以及检查和关闭Redis服务。
redis6.0.6下载地址

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]# 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值