腾讯云轻量服务器Centos 7.6安装redis 5.0.4教程

1. 在Redis官网下载redis,下载完后上传到服务器上。下载地址:Index of /releases/

2. 在/usr/local/目录下创建software文件夹,在software下创建redis文件夹

[root@VM-4-16-centos ~]# mkdie software
[root@VM-4-16-centos ~]# cd software
[root@VM-4-16-centos ~]# mkdie redis
[root@VM-4-16-centos ~]# cd

3. 回到根目录,解压Redis到redis文件夹下

[root@VM-4-16-centos ~]# tar -zxvf redis-5.0.4.tar.gz -C /usr/local/software/redis/

4.安装gcc

[root@VM-4-16-centos redis-5.0.4]# yum install gcc-c++

5. 编译

[root@VM-4-16-centos redis-5.0.4]# make

 6. 安装Redis,PREFIX=/usr/local/redis是安装路径

[root@VM-4-16-centos redis]# make install PREFIX=/usr/local/redis

7. 拷贝redis.conf文件到redis安装路径下

[root@VM-4-16-centos redis-5.0.4]# cp redis.conf /usr/local/redis/bin/

8. 编辑redis安装路径下的redis.conf

 

[root@VM-4-16-centos bin]# vim redis.conf

需要修改的地方:修改时可以使用 / 进行搜索,例如搜索bind配置,/bind 然后按n进行寻找

1. 修改bind 127.0.0.1

bind 127.0.0.1修改为bind 0.0.0.0

2. 修改 daemonize

daemonize no 修改为 daemonize yes

表示可以后台运行

3. 修改requirepass,这个是配置登录密码的

# requirepass foobared 修改为 requirepass xxxxxx

说明:删除# 放开注释,后面的xxxxxx是需要使用的密码

4. 修改默认端口号(默认端口号是:6379) ,该项的修改可以根据自己的需求是否决定需要修改

port 6379 修改为 port xxxx

说明:xxxx是修改后的端口号,如果修改过端口号,需要将服务器上对应的端口号放开。腾讯云服务器是在 管理-防火墙,选择添加规则进行开放

 9. 启动Redis

[root@VM-4-16-centos bin]# ./redis-server redis.conf

 查看redis的启动:ps -ef | grep redis

10. 登录Redis客户端验证

[root@VM-4-16-centos bin]# ./redis-cli -h 127.0.0.1 -p 端口 -a 密码
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6597> 

如上表示已登录,然后可以使用一些Redis命令验证了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值