“Yum”的版本间的差异
		
		
		
		
		
		跳到导航
		跳到搜索
		
				
		
		
	
| Jihongchang(讨论 | 贡献) | Jihongchang(讨论 | 贡献)  | ||
| 第3行: | 第3行: | ||
| 基于 RPM 包管理,能够从指定的服务器自动下载 RPM 包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。 | 基于 RPM 包管理,能够从指定的服务器自动下载 RPM 包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。 | ||
| + | |||
| === 显示配置的软件存储库 === | === 显示配置的软件存储库 === | ||
| 第23行: | 第24行: | ||
| [root@localhost docker_zk]# | [root@localhost docker_zk]# | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| + | |||
| === 查看已安装 === | === 查看已安装 === | ||
| 第29行: | 第31行: | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| − | ===  | + | |
| + | === 确认是否安装 === | ||
| <syntaxhighlight lang="shell-session"> | <syntaxhighlight lang="shell-session"> | ||
| [root@localhost docker_zk]# yum list installed|grep wget | [root@localhost docker_zk]# yum list installed|grep wget | ||
| 第38行: | 第41行: | ||
| [root@localhost docker_zk]# | [root@localhost docker_zk]# | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| + | |||
| === 安装 yum-utils === | === 安装 yum-utils === | ||
| 第48行: | 第52行: | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| + | |||
| === yum 添加镜像 === | === yum 添加镜像 === | ||
| 第58行: | 第63行: | ||
| [root@localhost docker_zk]# | [root@localhost docker_zk]# | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| + | |||
| === yum makecache === | === yum makecache === | ||
| 第69行: | 第75行: | ||
| [root@localhost docker_zk]# | [root@localhost docker_zk]# | ||
| </syntaxhighlight> | </syntaxhighlight> | ||
| + | |||
| + | |||
| + | === 安装 epel-release === | ||
2022年8月15日 (一) 21:55的版本
简介
Yum(全称为 Yellow dog Updater, Modified)是一个在 Fedora 和 RedHat 以及 CentOS 中的 Shell 前端软件包管理器。
基于 RPM 包管理,能够从指定的服务器自动下载 RPM 包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。
显示配置的软件存储库
[root@localhost docker_zk]# yum repolist
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Loading mirror speeds from cached hostfile
 * base: mirrors.bfsu.edu.cn
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.bfsu.edu.cn
repo id                                            repo name                                  status
!base/7/x86_64                                     CentOS-7 - Base                            10,072
!extras/7/x86_64                                   CentOS-7 - Extras                             500
!mysql-connectors-community/x86_64                 MySQL Connectors Community                    221
!mysql-tools-community/x86_64                      MySQL Tools Community                         135
!mysql56-community/x86_64                          MySQL 5.6 Community Server                    581
!updates/7/x86_64                                  CentOS-7 - Updates                          2,943
repolist: 14,452
[root@localhost docker_zk]#
查看已安装
[root@localhost docker_zk]# yum list installed
确认是否安装
[root@localhost docker_zk]# yum list installed|grep wget
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
wget.x86_64                          1.14-18.el7_6.1                @base
[root@localhost docker_zk]# yum list installed|grep yum-utils
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
[root@localhost docker_zk]#
安装 yum-utils
yum-utils 包含可以添加 yum 镜像的 yum-config-manager
[root@localhost docker_zk]# yum install -y yum-utils
......
[root@localhost docker_zk]# yum list installed|grep yum-utils
yum-utils.noarch                     1.1.31-54.el7_8                @base
[root@localhost docker_zk]#
yum 添加镜像
这里以 docker 镜像为例
[root@localhost docker_zk]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror
adding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@localhost docker_zk]#
yum makecache
添加镜像或缓存过期时需要进行此操作
用于下载当前启用的 yum 存储库的所有元数据并使其可用。
如果参数“fast”被传递,那么我们只是尝试确保 repos 是最新的(很像“yum clean expire-cache”)。
[root@localhost docker_zk]# yum makecache fast
 ...
[root@localhost docker_zk]#