美文网首页
Linux(Centos7.3)yum安装最新redis

Linux(Centos7.3)yum安装最新redis

作者: 魔法师_ | 来源:发表于2017-07-04 17:17 被阅读0次

1、启用EPEL仓库

wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

rpm -ivh epel-release-7-5.noarch.rpm

要验证EPEL仓库是否建立成功,可以执行:

# yum repolist

编译需要gcc环境,如果没有gcc环境

yum install gcc

2、通过Yum安装Redis

# yum -y update

# yum install redis

#systemctl start redis

#systemctl enable  redis.service

3、Redis开启远程登录连接

原来是redis默认只能localhost登录,所以需要开启远程登录。解决方法如下:

在redis的配置文件redis.conf中,找到bind localhost注释掉。

注释掉本机,局域网内的所有计算机都能访问。

band localhost 只能本机访问,局域网内计算机不能访问。

bind 局域网IP 只能局域网内IP的机器访问, 本地localhost都无法访问。

我没有注释掉bind 127.0.0.1,而是将bind 127.0.0.1 改成了bind 0.0.0.0。

然后要配置防火墙 开放端口6379

高级设置

设置redis密码

注释redis.conf文件中的:bind 127.0.0.1(在一段文字之前打#号为注释)

打开文件/etc/redis.conf,找到其中的# requirepass foobared,去掉前面的#,并把foobared改成你的密码。

redis.conf文件默认在/etc目录下,你可以更改它的位置和名字,更改后,注意在文件/usr/lib/systemd/system/redis.service中,把ExecStart=/usr/bin/redis-server /etc/redis/6379.conf --daemonize no中的redis.conf的路径改成的新的路径。

相关文章

网友评论

      本文标题:Linux(Centos7.3)yum安装最新redis

      本文链接:https://www.haomeiwen.com/subject/apexhxtx.html