服务器安装完mysql后紧结着安装redis
1. 先尝试直接用yum install redis 来安装,结果失败
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.bupt.edu.cn
* updates: mirrors.huaweicloud.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
mysql-connectors-community | 2.6 kB 00:00:00
mysql-tools-community | 2.6 kB 00:00:00
mysql57-community | 2.6 kB 00:00:00
updates | 2.9 kB 00:00:00
No package redis available.
Error: Nothing to do
有些奇怪为什么会报mysql的问题!
后来按自己原来记得命令执行
yum install epel-release
yum install redis
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
Userid : "Fedora EPEL (7) <epel@fedoraproject.org>"
Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
Package : epel-release-7-11.noarch (@extras)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : jemalloc-3.6.0-1.el7.x86_64 1/2
Installing : redis-3.2.12-2.el7.x86_64 2/2
Verifying : redis-3.2.12-2.el7.x86_64 1/2
Verifying : jemalloc-3.6.0-1.el7.x86_64 2/2
Installed:
redis.x86_64 0:3.2.12-2.el7
Dependency Installed:
jemalloc.x86_64 0:3.6.0-1.el7
Complete!
之后安装成功
之后配置可以远程访问
vim /etc/redis.conf
注释掉 bind 127.0.0.1
daemonize 设置成yes,代表后台运行,redis不会随着客户端关闭而关闭
requirepass 设置密码
启动redis
systemctl start redis
设置开机自动启动
chkconfig redis on
最后开放端口
# 端口开放
firewall-cmd --zone=public --add-port=6379/tcp --permanent
# 重启防火墙
firewall-cmd --reload
# 检查端口是否正常开启
firewall-cmd --list-ports
使用yum安装redis的过程可以说是顺利的多~