网站首页 > 技术教程 正文
今天在一台干净的服务器上,安装redis, 一般大家都知道 yum install redis 这种方式。
但是这样直接通过yum 安装,会提示无依赖包
[root@localhost test]# yum install redis
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.163.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
nginx | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
没有可用软件包 redis。
错误:无须任何处理
首先检查已有的镜像,并备份已有的镜像
[root@localhost wyz]# ll /etc/yum.repos.d/
总用量 36
-rw-r--r--. 1 root root 1664 11月 23 2018 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 11月 23 2018 CentOS-CR.repo
-rw-r--r--. 1 root root 649 11月 23 2018 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 11月 23 2018 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 11月 23 2018 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 11月 23 2018 CentOS-Sources.repo
-rw-r--r--. 1 root root 5701 11月 23 2018 CentOS-Vault.repo
-rw-r--r--. 1 root root 113 7月 15 2014 nginx.repo
备份已有的镜像,并切换阿里云,然后重新下载,接着安装redis,结果还是没有
-rw-r--r--. 1 root root 113 7月 15 2014 nginx.repo
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
--2021-09-30 10:21:35-- http://mirrors.aliyun.com/repo/Centos-7.repo
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 61.162.46.208, 27.221.122.241, 27.221.122.239, ...
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|61.162.46.208|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:2523 (2.5K) [application/octet-stream]
正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”
100%[=======================================================================================================================>] 2,523 --.-K/s 用时 0s
2021-09-30 10:21:35 (77.8 MB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2523/2523])
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# ll
总用量 40
-rw-r--r--. 1 root root 2523 12月 26 2020 CentOS-Base.repo
-rw-r--r--. 1 root root 1664 11月 23 2018 CentOS-Base.repo.bak
-rw-r--r--. 1 root root 1309 11月 23 2018 CentOS-CR.repo
-rw-r--r--. 1 root root 649 11月 23 2018 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 314 11月 23 2018 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 11月 23 2018 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 11月 23 2018 CentOS-Sources.repo
-rw-r--r--. 1 root root 5701 11月 23 2018 CentOS-Vault.repo
-rw-r--r--. 1 root root 113 7月 15 2014 nginx.repo
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# yum install redis
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
没有可用软件包 redis。
错误:无须任何处理
既然镜像中没有这些安装包,那我们需要从fedora的epel仓库。
yum install epel-relase
[root@localhost yum.repos.d]# yum install redis
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
没有可用软件包 redis。
错误:无须任何处理
[root@localhost yum.repos.d]# yum install epel-release
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 epel-release.noarch.0.7-11 将被 安装
--> 解决依赖关系完成
依赖关系解决
=================================================================================================================================================================
Package 架构 版本 源 大小
=================================================================================================================================================================
正在安装:
epel-release noarch 7-11 extras 15 k
事务概要
=================================================================================================================================================================
安装 1 软件包
总下载量:15 k
安装大小:24 k
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/extras/packages/epel-release-7-11.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
epel-release-7-11.noarch.rpm 的公钥尚未安装
epel-release-7-11.noarch.rpm | 15 kB 00:00:00
从 http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
用户ID : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
指纹 : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
来自 : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : epel-release-7-11.noarch 1/1
验证中 : epel-release-7-11.noarch 1/1
已安装:
epel-release.noarch 0:7-11
完毕!
[root@localhost yum.repos.d]#
查看已有的
[root@localhost yum.repos.d]# yum repolist
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 5.8 kB 00:00:00
* base: mirrors.aliyun.com
* epel: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
epel | 4.7 kB 00:00:00
(1/3): epel/x86_64/group_gz | 96 kB 00:00:00
(2/3): epel/x86_64/updateinfo | 1.0 MB 00:00:00
(3/3): epel/x86_64/primary_db | 7.0 MB 00:00:00
源标识 源名称 状态
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,072
*epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,674
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 500
nginx/x86_64 nginx repo 242
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 2,751
repolist: 27,239
[root@localhost yum.repos.d]#
装redis, 开始造
[root@localhost yum.repos.d]# yum install redis
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.ustc.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 redis.x86_64.0.3.2.12-2.el7 将被 安装
--> 正在处理依赖关系 libjemalloc.so.1()(64bit),它被软件包 redis-3.2.12-2.el7.x86_64 需要
--> 正在检查事务
---> 软件包 jemalloc.x86_64.0.3.6.0-1.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=================================================================================================================================================================
Package 架构 版本 源 大小
=================================================================================================================================================================
正在安装:
redis x86_64 3.2.12-2.el7 epel 544 k
为依赖而安装:
jemalloc x86_64 3.6.0-1.el7 epel 105 k
事务概要
=================================================================================================================================================================
安装 1 软件包 (+1 依赖软件包)
总下载量:648 k
安装大小:1.7 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/epel/packages/jemalloc-3.6.0-1.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 352c64e5: NOKEY
jemalloc-3.6.0-1.el7.x86_64.rpm 的公钥尚未安装
(1/2): jemalloc-3.6.0-1.el7.x86_64.rpm | 105 kB 00:00:00
(2/2): redis-3.2.12-2.el7.x86_64.rpm | 544 kB 00:00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 1.4 MB/s | 648 kB 00:00:00
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 检索密钥
导入 GPG key 0x352C64E5:
用户ID : "Fedora EPEL (7) <epel@fedoraproject.org>"
指纹 : 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
软件包 : epel-release-7-11.noarch (@extras)
来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : jemalloc-3.6.0-1.el7.x86_64 1/2
正在安装 : redis-3.2.12-2.el7.x86_64 2/2
验证中 : redis-3.2.12-2.el7.x86_64 1/2
验证中 : jemalloc-3.6.0-1.el7.x86_64 2/2
已安装:
redis.x86_64 0:3.2.12-2.el7
作为依赖被安装:
jemalloc.x86_64 0:3.6.0-1.el7
完毕!
启动Redis
[root@localhost yum.repos.d]# service redis start
Redirecting to /bin/systemctl start redis.service
或者
# 启动redis
systemctl start redis
# 开机自动启动Redis
systemctl enable redis
#停止redis
systemctl stop redis
#查看Redis运行状态
systemctl status redis
修改端口等信息
通过在/etc/redis.conf编辑, 比如修改port, 密码,可链接的ip的信息
port : 修改端口
requier: 设置密码
bind: 设置链接redis的IP
protec
修改完之后,如果继续使用 service start redis,redis并没有使用最新的配置文件,也就是说,你改动的,没有生效。所以需要指定配置文件启动
/usr/bin/redis-server /etc/redis.conf &
客户端登录 redis-cli
默认情况下,
redis-cli 是无密码连接的6379端口,并登录,如果修改过配置信息
redis-cli -h 127.0.0.1 -p 7379 -a yourpasswd
或者
# redis-cli -p 7895 登录
# auth yourpasswd
登录
# keys *
退出
shutdown/quit
猜你喜欢
- 2024-10-13 nginx做限流设置(nginx 限流10000每秒)
- 2024-10-13 Nginx不归路:架构基础篇(nginx 原理与架构)
- 2024-10-13 蓝易云 - 什么是HTTP500内部服务器错误,要如何修复?
- 2024-09-28 thinkphp5出现500错误怎么办(thinkphp页面错误)
- 2024-09-28 QPS提升60%,阿里巴巴轻量级开源 Web 服务器Tengine负载均衡算法
- 2024-09-28 2020年面试复盘大全500道:Redis+ZK+Nginx+数据库+分布式+微服务
- 2024-09-28 网页出现500错误是什么问题(网页500报错)
- 2024-09-28 Nginx限流配置详解(nginx 限流10000每秒)
- 2024-09-28 nginx 500 502 504 区别(nginx502和504)
你 发表评论:
欢迎- 最近发表
-
- Win10 TH2正式版官方ESD映像转换ISO镜像方法详解
- 使用iso镜像升级到Windows 10的步骤
- macOS Ventura 13.2 (22D49) Boot ISO 原版可引导镜像
- 安利一个用ISO镜像文件制作引导U盘的的小工具RUFUS
- CentOS 7使用ISO镜像配置本地yum源
- 用于x86平台的安卓9.0 ISO镜像发布下载:通吃I/A/N、完全免费
- AlmaLinux 9.6发布:升级工具、初步支持IBM Power虚拟化技术
- Rufus写入工具简洁介绍与教程(写入模式)
- 新硬件也能安装使用了,Edge版Linux Mint 21.3镜像发布
- 开源工程师:Ubuntu应该抛弃32位ISO镜像
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)