【CentOS 7.9】安装redis笔记

服务器安装完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的过程可以说是顺利的多~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值