Linux网络服务-yum仓库

YUM简介

yum是一个基于RPM包(是Red-Hat Package Manager红帽软件包管理器的缩写)构建的软件更新机制,能够自动解决软件包之间的依赖关系。解决了日常工作中的大量查找安装依赖包的时间
yum由仓库和客户端组成,也就是整个yum由两部分组成,所以yum可以存放在两台服务器上。也可以存放在一台服务器上。可以有官方来提供服务,也可以由第三方来提供,比如国内的阿里云,搜狐云,还有一些非盈利组织比如学校等。官方的源一般在国外,下载速度肯定有限,手动更改成国内的云可以大幅提升下载速度。
YUM 的前身是 YUP(Yellow dog Updater,Yellow dog Linux 的软件更新器),最初由 TSS 公司(Terra Soft Solutions,INC.)使用 Python 语言开发而成,后来由杜克大学(Duck University)的 Linux 开发队伍进行改进,命名为 YUM(Yellow dog Updater,Modified)。 要成功使用 YUM 机制来更新系统和软件,需要有一个包含各种 rpm 安装包文件及其依 赖软件的软件仓库(repository),提供软件仓库的服务器也称为“源”服务器。在客户机中只 要正确指定软件仓库的地址等信息,就可以通过对应的“源”服务器来安装或更新软件。

YUM实现过程

要有安装包

安装包:

1.光驱里自带 挂载提供软件包

先在yum服务器上创建 yum repository(仓库),在仓库中事先存储了众多rpm包,以及包的相关的元数据文件(放置于特定目录repodata下),当yum客户端利用yum/dnf工具进行安装时包时,会自动下载repodata中的元数据,查询远数据是否存在相关的包及依赖关系,自动从仓库中找到相关包下载并安装。
在这里插入图片描述
yum需要依赖于环境,依赖于服务端和客户端,允许跨网络

服务器:

  • RPM包 (Packages文件夹中)
  • 元数据(repodata文件夹:目录(软件的目录),软件的依赖关系,软件的位置)

客户端的配置文件中

baseurl=地址 一定要写到到 这两个文件夹 repodata packages 的上级目录

最终形成两个文件夹Packages (包文件夹一般取名packages)和 repodata(元数据文件夹)

仓库类型:

  • 光盘的仓库基本仓库 比较常用的
  • epel扩展仓库 比较新

如何实现安装服务

在这里插入图片描述

yum配置文件

主配置文件

[root@localhost ~]# vim /etc/yum.conf    //主配置文件
cachedir=/var/cache/yum/$basearch/$releasever //yum下载的RPM包的缓存目录 $basearch代表硬件架构 $releasever系统版本比如7
keepcache=0                                   //是否保存缓存  0代表不保存,1代表保存
debuglevel=2                                  //调试级别了解即可
logfile=/var/log/yum.log					 // 日志文件位置
exactarch=1								     //是否允许不同版本的rpm安装
obsoletes=1									//update 的一个参数是否可以允许旧版本的运行	
gpgcheck=1                                  //验证秘钥
plugins=1                                   //是否允许插件1代表可以
installonly_limit=5                         //保存几个内核 5代表5个
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

yum的repo配置文件中可用的变量:
$releasever: 当前OS的发行版的主版本号,如:876
$arch: CPU架构,如:aarch64, i586, i686,x86_64等
$basearch:系统基础平台;i386, x86_64
$contentdir:表示目录,比如:centos-8,centos-7
$YUM0-$YUM9:自定义变量

在这里插入图片描述

仓库设置文件

例子里是默认的yum仓库 是centos官方的yum源,需要联网才可以使用


[root@localhost ~]# /etc/yum.repos.d/*.repo      //**yum仓库文件位置**

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

在这里插入图片描述

日志文件

[root@localhost yum.repos.d]# cat /var/log/yum.log //查看日志文件

yum命令详解

命令不加关键字加入关键词、软件包、软件包组
yum list显示所有可用包单个的可安装包
yum info显示所有可用包的信息单个具体的信息
yum search\模糊查找所有的相关信息
yum provides\精确查找
yum grouplist显示所有可用包组显示具体的包组
yum groupinfo显示所有的包组具体信息显示具体的包组的具体信息
yum install\安装具体软件包
yum groupinstall\安装具体软件包组
yum update所有软件升级具体软件升级
yum group update所有包组升级
yum remove\卸载具体软件
yum groupremove\卸载具体包组软件
yum history查看当前yum操作历史|
yum history undo加入序号卸载序号里安装的软件\
yum history redo加入序号重新执行序号里的操作\

yum查询

yum list [软件名]

显示可用的安装包,如不加软件名是显示所有的可用包,由于软件过多不做例子。

[root@localhost ~]# yum list httpd
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
可安装的软件包
httpd.x86_64  


[root@localhost ~]# yum list *httpd*   //#包含httpd 的软件包
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
可安装的软件包
httpd.x86_64                            2.4.6-98.el7.centos.6 updates
httpd-devel.x86_64                      2.4.6-98.el7.centos.6 updates
httpd-manual.noarch                     2.4.6-98.el7.centos.6 updates
httpd-tools.x86_64                      2.4.6-98.el7.centos.6 updates
keycloak-httpd-client-install.noarch    0.8-1.el7             base   
libmicrohttpd.i686                      0.9.33-2.el7          base   
libmicrohttpd.x86_64                    0.9.33-2.el7          base   
libmicrohttpd-devel.i686                0.9.33-2.el7          base   
libmicrohttpd-devel.x86_64              0.9.33-2.el7          base   
libmicrohttpd-doc.noarch                0.9.33-2.el7          base   
python2-keycloak-httpd-client-install.noarch
                                        0.8-1.el7             base   

在这里插入图片描述

yum info [软件名]

显示安装包详细信息,详情如下

[root@localhost ~]# yum info httpd
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
可安装的软件包
名称    :httpd
架构    :x86_64
版本    :2.4.6
发布    :98.el7.centos.6
大小    :2.7 M
源    :updates/7/x86_64
简介    : Apache HTTP Server
网址    :http://httpd.apache.org/
协议    : ASL 2.0
描述    : The Apache HTTP Server is a powerful, efficient, and extensible
         : web server.

在这里插入图片描述
(如不加软件名是显示所有包的详细信息)

yum search <关键词>

根据关键字查找软件安装包,相当于你只知道这个包里的某个关键字会全部给你匹配出来

[root@localhost ~]# yum search ftp
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
===================================================================================== N/S matched: ftp ======================================================================================
ftp.x86_64 : The standard UNIX FTP (File Transfer Protocol) client
lftp-scripts.noarch : Scripts for lftp
syslinux-tftpboot.noarch : SYSLINUX modules in /var/lib/tftpboot, available for network booting
tftp.x86_64 : The client for the Trivial File Transfer Protocol (TFTP)
tftp-server.x86_64 : The server for the Trivial File Transfer Protocol (TFTP)
vsftpd.x86_64 : Very Secure Ftp Daemon
vsftpd-sysvinit.x86_64 : SysV initscript for vsftpd daemon
curl.x86_64 : A utility for getting files from remote servers (FTP, HTTP, and others)
lftp.i686 : A sophisticated file transfer program
lftp.x86_64 : A sophisticated file transfer program
wget.x86_64 : A utility for retrieving files using the HTTP or FTP protocols


在这里插入图片描述

yum provides <关键词>

你知道某个命令却不知道具体的包可以用此命令查找

[root@localhost ~]# rpm -ivh httpd-2.4.6-67.el7.centos.x86_64.rpm 

[root@localhost ~]# yum provides httpd-tools
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
httpd-tools-2.4.6-95.el7.centos.x86_64 : Tools for use with the Apache HTTP Server
源    :base

[root@localhost ftp]#ll /etc/mime.types 
-rw-r--r--. 1 root root 51787 515 2013 
/etc/mime.types
[root@localhost ftp]#yum provides mime.types
#不写路径查找不到
No matches found
[root@localhost ftp]#yum provides  */mime.types
#加上通配符


[root@localhost ~]# yum  whatprovides ftp
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
ftp-0.17-67.el7.x86_64 : The standard UNIX FTP (File Transfer Protocol) client
源    :base



ftp-0.17-67.el7.x86_64 : The standard UNIX FTP (File Transfer Protocol) client
源    :@base

在这里插入图片描述

yum grouplist [包组名]

安装包组的查询 不加包组名 就是显示所有(此处例子由于安装了中文环境,无法显示英文包组名称无法直接复制中文使用,建议直接安装英文操作系统)

[root@localhost ~]#  yum grouplist
已加载插件:fastestmirror, langpacks
没有安装组信息文件
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
可用的环境分组:
   最小安装
   基础设施服务器
   计算节点
   文件及打印服务器
   基本网页服务器
   虚拟化主机
   带 GUI 的服务器
   GNOME 桌面
   KDE Plasma Workspaces
   开发及生成工作站
可用组:
   传统 UNIX 兼容性
   兼容性程序库
   图形管理工具
   安全性工具
   开发工具
   控制台互联网工具
   智能卡支持
   科学记数法支持
   系统管理
   系统管理工具
完成

在这里插入图片描述

yum groupinfo <包组名>

不加包组名显示全部

[root@localhost ~]# yum groupinfo "GNOME Desktop"
已加载插件:fastestmirror, langpacks
没有安装组信息文件
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn

环境分组:GNOME 桌面
环境 ID:gnome-desktop-environment
 描述:GNOME 是一个非常直观且用户友好的桌面环境。
必备组:
   +base
   +core
   +desktop-debugging
   +dial-up
   +directory-client
   +fonts
   +gnome-desktop
   +guest-agents
   +guest-desktop-agents
   +input-methods
   +internet-browser
   +java-platform
   +multimedia
   +network-file-system-client
   +networkmanager-submodules
   +print-client
   +x11
可选组:
   +backup-client
   +gnome-apps
   +internet-applications
   +legacy-x
   +office-suite
   +remote-desktop-clients
   +smart-card

在这里插入图片描述

yum安装升级

yum install [软件名]

安装软件包,如例子yum install安装http服务

[root@localhost ~]# yum install httpd -y
BDB2053 Freeing read locks for locker 0xe38: 3809/140279275546432
BDB2053 Freeing read locks for locker 0xe3a: 3809/140279275546432
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.ustc.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-98.el7.centos.6 将被 安装
--> 正在处理依赖关系 httpd-tools = 2.4.6-98.el7.centos.6,它被软件包 httpd-2.4.6-98.el7.centos.6.x86_64 需要
--> 正在处理依赖关系 /etc/mime.types,它被软件包 httpd-2.4.6-98.el7.centos.6.x86_64 需要
--> 正在处理依赖关系 libaprutil-1.so.0()(64bit),它被软件包 httpd-2.4.6-98.el7.centos.6.x86_64 需要
--> 正在处理依赖关系 libapr-1.so.0()(64bit),它被软件包 httpd-2.4.6-98.el7.centos.6.x86_64 需要
--> 正在检查事务
---> 软件包 apr.x86_64.0.1.4.8-7.el7 将被 安装
---> 软件包 apr-util.x86_64.0.1.5.2-6.el7 将被 安装
---> 软件包 httpd-tools.x86_64.0.2.4.6-98.el7.centos.6 将被 安装
---> 软件包 mailcap.noarch.0.2.1.41-2.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

=============================================================================================================================================================================================
 Package                                      架构                                    版本                                                    源                                        大小
=============================================================================================================================================================================================
正在安装:
 httpd                                        x86_64                                  2.4.6-98.el7.centos.6                                   updates                                  2.7 M
为依赖而安装:
 apr                                          x86_64                                  1.4.8-7.el7                                             base                                     104 k
 apr-util                                     x86_64                                  1.5.2-6.el7                                             base                                      92 k
 httpd-tools                                  x86_64                                  2.4.6-98.el7.centos.6                                   updates                                   94 k
 mailcap                                      noarch                                  2.1.41-2.el7                                            base                                      31 k

事务概要
=============================================================================================================================================================================================
安装  1 软件包 (+4 依赖软件包)

总下载量:3.0 M
安装大小:10 M
Downloading packages:
警告:/var/cache/yum/x86_64/7/base/packages/apr-1.4.8-7.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
apr-1.4.8-7.el7.x86_64.rpm 的公钥尚未安装
(1/5): apr-1.4.8-7.el7.x86_64.rpm                                                                                                                                     | 104 kB  00:00:00     
(2/5): apr-util-1.5.2-6.el7.x86_64.rpm                                                                                                                                |  92 kB  00:00:00     
httpd-tools-2.4.6-98.el7.centos.6.x86_64.rpm 的公钥尚未安装
(3/5): httpd-tools-2.4.6-98.el7.centos.6.x86_64.rpm                                                                                                                   |  94 kB  00:00:00     
(4/5): mailcap-2.1.41-2.el7.noarch.rpm                                                                                                                                |  31 kB  00:00:00     
(5/5): httpd-2.4.6-98.el7.centos.6.x86_64.rpm                                                                                                                         | 2.7 MB  00:00:00     
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                         3.8 MB/s | 3.0 MB  00:00:00     
从 file:///etc/pki/rpm-gpg/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
 软件包     : centos-release-7-4.1708.el7.centos.x86_64 (@anaconda)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : apr-1.4.8-7.el7.x86_64                                                                                                                                                   1/5 
  正在安装    : apr-util-1.5.2-6.el7.x86_64                                                                                                                                              2/5 
  正在安装    : httpd-tools-2.4.6-98.el7.centos.6.x86_64                                                                                                                                 3/5 
  正在安装    : mailcap-2.1.41-2.el7.noarch                                                                                                                                              4/5 
  正在安装    : httpd-2.4.6-98.el7.centos.6.x86_64                                                                                                                                       5/5 
  验证中      : httpd-tools-2.4.6-98.el7.centos.6.x86_64                                                                                                                                 1/5 
  验证中      : mailcap-2.1.41-2.el7.noarch                                                                                                                                              2/5 
  验证中      : apr-1.4.8-7.el7.x86_64                                                                                                                                                   3/5 
  验证中      : httpd-2.4.6-98.el7.centos.6.x86_64                                                                                                                                       4/5 
  验证中      : apr-util-1.5.2-6.el7.x86_64                                                                                                                                              5/5 

已安装:
  httpd.x86_64 0:2.4.6-98.el7.centos.6                                                                                                                                                       

作为依赖被安装:
  apr.x86_64 0:1.4.8-7.el7                apr-util.x86_64 0:1.5.2-6.el7                httpd-tools.x86_64 0:2.4.6-98.el7.centos.6                mailcap.noarch 0:2.1.41-2.el7               

完毕!

yum groupinstall <包组名>、

包组安装同yum install 不做过多叙述(包组过多省略结果)

[root@localhost ~]# yum group install gnome desktop -y
已加载插件:fastestmirror, langpacks
没有安装组信息文件
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.ustc.edu.cn
Warning: group desktop does not exist.
正在解决依赖关系
--> 正在检查事务
---> 软件包 qgnomeplatform.x86_64.0.0.3-5.el7 将被 安装
--> 正在处理依赖关系 qt5-qtbase(x86-64) = 5.9.7,它被软件包 qgnomeplatform-0.3-5.el7.x86_64 需要
--> 正在处理依赖关系 libQt5Widgets.so.5(Qt_5)(64bit),它被软件包 qgnomeplatform-0.3-5.el7.x86_64 需要
--> 正在处理依赖关系 libQt5Gui.so.5(Qt_5_PRIVATE_API)(64bit),它被软件包 qgnomeplatform-0.3-5.el7.x86_64 需要
--> 正在处理依赖关系 libQt5Gui.so.5(Qt_5)(64bit),它被软件包 qgnomeplatform-0.3-5.el7.x86_64 需要
--> 正在处理依赖关系 libQt5Core.so.5(Qt_5.9)(64bit),它被软件包 qgnomeplatform-0.3-5.el7.x86_64 需要
--> 正在处理依赖关系 libQt5Core.so.5(Qt_5)(64bit),它被软件包 qgnomeplatform-0.3-5.el7.x86_64 需要
--> 正在处理依赖关系 highcontrast-qt5(x86-64),它被软件包 qgnomeplatform-0.3-5.el7.x86_64 需要
--> 正在处理依赖关系 adwaita-qt5(x86-64),它被软件包 qgnomeplatform-0.3-5.el7.x86_64 需要
--> 正在处理依赖关系 libQt5Widgets.so.5()(64bit),它被软件包 qgnomeplatform-0.3-5.el7.x86_64 需要
--> 正在处理依赖关系 libQt5Gui.so.5()(64bit),它被软件包 qgnomeplatform-0.3-5.el7.x86_64 需要
--> 正在处理依赖关系 libQt5DBus.so.5()(64bit),它被软件包 qgnomeplatform-0.3-5.el7.x86_64 需要
--> 正在处理依赖关系 libQt5Core.so.5()(64bit),它被软件包 qgnomeplatform-0.3-5.el7.x86_64 需要
--> 正在检查事务
---> 软件包 adwaita-qt5.x86_64.0.1.0-1.el7 将被 安装
---> 软件包 highcontrast-qt5.x86_64.0.0.1-2.el7 将被 安装
---> 软件包 qt5-qtbase.x86_64.0.5.9.7-5.el7_9 将被 安装
--> 正在处理依赖关系 qt5-qtbase-common = 5.9.7-5.el7_9,它被软件包 qt5-qtbase-5.9.7-5.el7_9.x86_64 需要
--> 正在处理依赖关系 libdbus-1.so.3(LIBDBUS_1_3)(64bit),它被软件包 qt5-qtbase-5.9.7-5.el7_9.x86_64 需要
--> 正在处理依赖关系 libpcre2-16.so.0()(64bit),它被软件包 qt5-qtbase-5.9.7-5.el7_9.x86_64 需要
---> 软件包 qt5-qtbase-gui.x86_64.0.5.9.7-5.el7_9 将被 安装
--> 正在处理依赖关系 libxcb-render-util.so.0()(64bit),它被软件包 qt5-qtbase-gui-5.9.7-5.el7_9.x86_64 需要
--> 正在处理依赖关系 libxcb-keysyms.so.1()(64bit),它被软件包 qt5-qtbase-gui-5.9.7-5.el7_9.x86_64 需要
--> 正在处理依赖关系 libxcb-image.so.0()(64bit),它被软件包 qt5-qtbase-gui-5.9.7-5.el7_9.x86_64 需要
--> 正在处理依赖关系 libxcb-icccm.so.4()(64bit),它被软件包 qt5-qtbase-gui-5.9.7-5.el7_9.x86_64 需要
--> 正在检查事务
---> 软件包 dbus-libs.x86_64.1.1.6.12-17.el7 将被 升级
--> 正在处理依赖关系 dbus-libs(x86-64) = 1:1.6.12-17.el7,它被软件包 1:dbus-1.6.12-17.el7.x86_64 需要
---> 软件包 dbus-libs.x86_64.1.1.10.24-15.el7 将被 更新
---> 软件包 pcre2-utf16.x86_64.0.10.23-2.el7 将被 安装
---> 软件包 qt5-qtbase-common.noarch.0.5.9.7-5.el7_9 将被 安装
---> 软件包 xcb-util-image.x86_64.0.0.4.0-2.el7 将被 安装
---> 软件包 xcb-util-keysyms.x86_64.0.0.4.0-1.el7 将被 安装
---> 软件包 xcb-util-renderutil.x86_64.0.0.3.9-3.el7 将被 安装
---> 软件包 xcb-util-wm.x86_64.0.0.4.1-5.el7 将被 安装
--> 正在检查事务
---> 软件包 dbus.x86_64.1.1.6.12-17.el7 将被 升级
--> 正在处理依赖关系 dbus = 1:1.6.12-17.el7,它被软件包 1:dbus-x11-1.6.12-17.el7.x86_64 需要
---> 软件包 dbus.x86_64.1.1.10.24-15.el7 将被 更新
--> 正在检查事务
---> 软件包 dbus-x11.x86_64.1.1.6.12-17.el7 将被 升级
---> 软件包 dbus-x11.x86_64.1.1.10.24-15.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

=============================================================================================================================================================================================
 Package                                             架构                                   版本                                               源                                       大小
=============================================================================================================================================================================================
Installing for group install "GNOME":
 qgnomeplatform                                      x86_64                                 0.3-5.el7                                          base                                     59 k
为依赖而安装:
 adwaita-qt5                                         x86_64                                 1.0-1.el7                                          base                                    188 k
 highcontrast-qt5                                    x86_64                                 0.1-2.el7                                          base                                    179 k
 pcre2-utf16                                         x86_64                                 10.23-2.el7                                        base                                    189 k
 qt5-qtbase                                          x86_64                                 5.9.7-5.el7_9                                      updates                                 3.1 M
 qt5-qtbase-common                                   noarch                                 5.9.7-5.el7_9                                      updates                                  26 k
 qt5-qtbase-gui                                      x86_64                                 5.9.7-5.el7_9                                      updates                                 5.4 M
 xcb-util-image                                      x86_64                                 0.4.0-2.el7                                        base                                     15 k
 xcb-util-keysyms                                    x86_64                                 0.4.0-1.el7                                        base                                     10 k
 xcb-util-renderutil                                 x86_64                                 0.3.9-3.el7                                        base                                     12 k
 xcb-util-wm                                         x86_64                                 0.4.1-5.el7                                        base                                     25 k
为依赖而更新:
 dbus                                                x86_64                                 1:1.10.24-15.el7                                   base                                    245 k
 dbus-libs                                           x86_64                                 1:1.10.24-15.el7                                   base                                    169 k
 dbus-x11                                            x86_64                                 1:1.10.24-15.el7                                   base                                     48 k

事务概要
=============================================================================================================================================================================================
安装  1 软件包 (+10 依赖软件包)
升级           (  3 依赖软件包)

总下载量:9.6 M
Downloading packages:
No Presto metadata available for base
(1/14): dbus-1.10.24-15.el7.x86_64.rpm                                                                                                                                | 245 kB  00:00:00     
(2/14): dbus-libs-1.10.24-15.el7.x86_64.rpm                                                                                                                           | 169 kB  00:00:00     
(3/14): adwaita-qt5-1.0-1.el7.x86_64.rpm                                                                                                                              | 188 kB  00:00:00     
(4/14): dbus-x11-1.10.24-15.el7.x86_64.rpm                                                                                                                            |  48 kB  00:00:00     
(5/14): highcontrast-qt5-0.1-2.el7.x86_64.rpm                                                                                                                         | 179 kB  00:00:00     
(6/14): pcre2-utf16-10.23-2.el7.x86_64.rpm                                                                                                                            | 189 kB  00:00:00     
(7/14): qgnomeplatform-0.3-5.el7.x86_64.rpm                                                                                                                           |  59 kB  00:00:00     
(8/14): qt5-qtbase-common-5.9.7-5.el7_9.noarch.rpm                                                                                                                    |  26 kB  00:00:00     
(9/14): xcb-util-image-0.4.0-2.el7.x86_64.rpm                                                                                                                         |  15 kB  00:00:00     
(10/14): xcb-util-keysyms-0.4.0-1.el7.x86_64.rpm                                                                                                                      |  10 kB  00:00:00     
(11/14): xcb-util-renderutil-0.3.9-3.el7.x86_64.rpm                                                                                                                   |  12 kB  00:00:00     
(12/14): xcb-util-wm-0.4.1-5.el7.x86_64.rpm                                                                                                                           |  25 kB  00:00:00     
(13/14): qt5-qtbase-5.9.7-5.el7_9.x86_64.rpm                                                                                                                          | 3.1 MB  00:00:01     
(14/14): qt5-qtbase-gui-5.9.7-5.el7_9.x86_64.rpm                                                                                                                      | 5.4 MB  00:00:01     
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                         5.2 MB/s | 9.6 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : 1:dbus-libs-1.10.24-15.el7.x86_64                                                                                                                                       1/17 
  正在更新    : 1:dbus-1.10.24-15.el7.x86_64                                                                                                                                            2/17 
  正在安装    : xcb-util-keysyms-0.4.0-1.el7.x86_64                                                                                                                                     3/17 
  正在安装    : pcre2-utf16-10.23-2.el7.x86_64                                                                                                                                          4/17 
  正在安装    : qt5-qtbase-common-5.9.7-5.el7_9.noarch                                                                                                                                  5/17 
  正在安装    : qt5-qtbase-5.9.7-5.el7_9.x86_64                                                                                                                                         6/17 
  正在安装    : xcb-util-renderutil-0.3.9-3.el7.x86_64                                                                                                                                  7/17 
  正在安装    : xcb-util-image-0.4.0-2.el7.x86_64                                                                                                                                       8/17 
  正在安装    : xcb-util-wm-0.4.1-5.el7.x86_64                                                                                                                                          9/17 
  正在安装    : qt5-qtbase-gui-5.9.7-5.el7_9.x86_64                                                                                                                                    10/17 
  正在安装    : highcontrast-qt5-0.1-2.el7.x86_64                                                                                                                                      11/17 
  正在安装    : adwaita-qt5-1.0-1.el7.x86_64                                                                                                                                           12/17 
  正在安装    : qgnomeplatform-0.3-5.el7.x86_64                                                                                                                                        13/17 
  正在更新    : 1:dbus-x11-1.10.24-15.el7.x86_64                                                                                                                                       14/17 
  清理        : 1:dbus-x11-1.6.12-17.el7.x86_64                                                                                                                                        15/17 
  清理        : 1:dbus-1.6.12-17.el7.x86_64                                                                                                                                            16/17 
  清理        : 1:dbus-libs-1.6.12-17.el7.x86_64                                                                                                                                       17/17 
  验证中      : xcb-util-wm-0.4.1-5.el7.x86_64                                                                                                                                          1/17 
  验证中      : xcb-util-image-0.4.0-2.el7.x86_64                                                                                                                                       2/17 
  验证中      : xcb-util-renderutil-0.3.9-3.el7.x86_64                                                                                                                                  3/17 
  验证中      : highcontrast-qt5-0.1-2.el7.x86_64                                                                                                                                       4/17 
  验证中      : pcre2-utf16-10.23-2.el7.x86_64                                                                                                                                          5/17 
  验证中      : qt5-qtbase-common-5.9.7-5.el7_9.noarch                                                                                                                                  6/17 
  验证中      : qt5-qtbase-gui-5.9.7-5.el7_9.x86_64                                                                                                                                     7/17 
  验证中      : xcb-util-keysyms-0.4.0-1.el7.x86_64                                                                                                                                     8/17 
  验证中      : qgnomeplatform-0.3-5.el7.x86_64                                                                                                                                         9/17 
  验证中      : adwaita-qt5-1.0-1.el7.x86_64                                                                                                                                           10/17 
  验证中      : 1:dbus-x11-1.10.24-15.el7.x86_64                                                                                                                                       11/17 
  验证中      : 1:dbus-1.10.24-15.el7.x86_64                                                                                                                                           12/17 
  验证中      : 1:dbus-libs-1.10.24-15.el7.x86_64                                                                                                                                      13/17 
  验证中      : qt5-qtbase-5.9.7-5.el7_9.x86_64                                                                                                                                        14/17 
  验证中      : 1:dbus-x11-1.6.12-17.el7.x86_64                                                                                                                                        15/17 
  验证中      : 1:dbus-libs-1.6.12-17.el7.x86_64                                                                                                                                       16/17 
  验证中      : 1:dbus-1.6.12-17.el7.x86_64                                                                                                                                            17/17 

已安装:
  qgnomeplatform.x86_64 0:0.3-5.el7                                                                                                                                                          

作为依赖被安装:
  adwaita-qt5.x86_64 0:1.0-1.el7                   highcontrast-qt5.x86_64 0:0.1-2.el7           pcre2-utf16.x86_64 0:10.23-2.el7            qt5-qtbase.x86_64 0:5.9.7-5.el7_9            
  qt5-qtbase-common.noarch 0:5.9.7-5.el7_9         qt5-qtbase-gui.x86_64 0:5.9.7-5.el7_9         xcb-util-image.x86_64 0:0.4.0-2.el7         xcb-util-keysyms.x86_64 0:0.4.0-1.el7        
  xcb-util-renderutil.x86_64 0:0.3.9-3.el7         xcb-util-wm.x86_64 0:0.4.1-5.el7             

作为依赖被升级:
  dbus.x86_64 1:1.10.24-15.el7                               dbus-libs.x86_64 1:1.10.24-15.el7                               dbus-x11.x86_64 1:1.10.24-15.el7                              

完毕!




#########安装图形化##########################
#如无法使用请先升级
yum -y upgrade
#再安装
yum -y groups install "GNOME Desktop"

yum update

更新包组,可以单个也可以全部 后面加具体包组名称就是单个更新,不加就是全部更新。

但是首先你要有更新的包组库否则也无法更新。

[root@localhost ~]# yum upgrade 

yum groupupdate

组包更新和单个安装包更新差不多此处不举例子赘述。

例子中没有更新的包组所以无法安装。

[root@localhost ~]# yum groupupdate 
已加载插件:fastestmirror, langpacks
没有安装组信息文件
Maybe run: yum groups mark convert (see man yum)
base                                                                                                                                                                  | 3.6 kB  00:00:00     
extras                                                                                                                                                                | 2.9 kB  00:00:00     
updates                                                                                                                                                               | 2.9 kB  00:00:00     
(1/4): base/7/x86_64/group_gz                                                                                                                                         | 153 kB  00:00:00     
(2/4): extras/7/x86_64/primary_db                                                                                                                                     | 249 kB  00:00:00     
(3/4): base/7/x86_64/primary_db                                                                                                                                       | 6.1 MB  00:00:01     
(4/4): updates/7/x86_64/primary_db                                                                                                                                    |  19 MB  00:00:02     
Determining fastest mirrors
 * base: mirrors.nju.edu.cn
 * extras: mirrors.nju.edu.cn
 * updates: mirrors.nju.edu.cn
Maybe run: yum groups mark install (see man yum)
指定组中没有可安装或升级的软件包

软件卸载

yum remove <软件名>

卸载已安装的软件必须加软件名

[root@localhost yum.repos.d]# yum remove 
已加载插件:fastestmirror, langpacks
错误:需要为 remove 指定软件包列表

[root@localhost yum.repos.d]# yum remove httpd

yum groupremove <包组名>

同软件包卸载不做赘述

yum history

查看历史的使用记录

[root@localhost ~]# yum history 
已加载插件:fastestmirror, langpacks
ID     | 登录用户                 | 日期和时间       | 操作           | 变更数 
-------------------------------------------------------------------------------
     1 | 系统 <>                | 2022-11-24 19:59 | Install        | 1318   
history list

选择ID 1,2,3,4,5

可以使用yum history undo 4 进行卸载,这样对比remove好处是可以将所有的依赖都删除

例子中将 4卸载

[root@localhost yum.repos.d]# yum history undo 4
[root@localhost yum.repos.d]# yum history info  4
#查看第四次具体安装了什么

如果后悔 卸载 可以使用两种方式

yum history redo 4 (重新安装一遍)

yum history undo 6 (反悔卸载等于重新安装一遍)

搭建仓库的方式

本地yum仓库 没有网络的情况下, 光盘

软件仓库的提供方式
FTP服务:ftp://ip地址/站点里路径
HTTP服务:http://域名或者ip地址/站点里的路径
本地目录:file://绝对路径 (file:///mnt 此处第三个/为根目录)

搭建本地yum仓库

搭建步骤:

步骤1、挂载光盘

[root@localhost ~]# mount /dev/sr0 /mnt
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# df -Th
文件系统                类型      容量  已用  可用 已用% 挂载点
/dev/mapper/centos-root xfs        50G  3.3G   47G    7% /
devtmpfs                devtmpfs  977M     0  977M    0% /dev
tmpfs                   tmpfs     993M     0  993M    0% /dev/shm
tmpfs                   tmpfs     993M   18M  976M    2% /run
tmpfs                   tmpfs     993M     0  993M    0% /sys/fs/cgroup
/dev/sda1               xfs       2.0G  161M  1.9G    8% /boot
tmpfs                   tmpfs     199M  4.0K  199M    1% /run/user/42
tmpfs                   tmpfs     199M   36K  199M    1% /run/user/0
/dev/sr0                iso9660   4.3G  4.3G     0  100% /mnt

在这里插入图片描述
注意:mount命令是一次性挂载,退出当前终端或重启后就不存在了。永久挂载需要修改配置文件/etc/fstab。

步骤2、切换到 /etc/yum.repo.d/目录,将自带的仓库文件移走

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo  CentOS-CR.repo  CentOS-Debuginfo.repo  CentOS-fasttrack.repo  CentOS-Media.repo  CentOS-Sources.repo  CentOS-Vault.repo
[root@localhost yum.repos.d]# mkdir aa
[root@localhost yum.repos.d]# mv *.repo aa
[root@localhost yum.repos.d]# ls
aa

在这里插入图片描述
步骤3、新建yum仓库文件



[bb]
name=bb
baseurl=file:///mnt
enabled=1
gpgcheck=0

在这里插入图片描述
步骤4、清理缓存并安装软件

[root@localhost yum.repos.d]# yum clean all 
已加载插件:fastestmirror, langpacks
正在清理软件源: bb
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@localhost yum.repos.d]# yum makecache
已加载插件:fastestmirror, langpacks
bb                                                                                                                                                                    | 3.6 kB  00:00:00     
(1/4): bb/group_gz                                                                                                                                                    | 156 kB  00:00:00     
(2/4): bb/primary_db                                                                                                                                                  | 3.1 MB  00:00:00     
(3/4): bb/filelists_db                                                                                                                                                | 3.1 MB  00:00:00     
(4/4): bb/other_db                                                                                                                                                    | 1.2 MB  00:00:00     
Determining fastest mirrors
元数据缓存已建立
[root@localhost yum.repos.d]#  yum install dhcp -y 
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 dhcp.x86_64.12.4.2.5-58.el7.centos 将被 安装
--> 解决依赖关系完成

依赖关系解决

=============================================================================================================================================================================================
 Package                                  架构                                       版本                                                       源                                      大小
=============================================================================================================================================================================================
正在安装:
 dhcp                                     x86_64                                     12:4.2.5-58.el7.centos                                     bb                                     513 k

事务概要
=============================================================================================================================================================================================
安装  1 软件包

总下载量:513 k
安装大小:1.4 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : 12:dhcp-4.2.5-58.el7.centos.x86_64                                                                                                                                       1/1 
  验证中      : 12:dhcp-4.2.5-58.el7.centos.x86_64                                                                                                                                       1/1 

已安装:
  dhcp.x86_64 12:4.2.5-58.el7.centos                                                                                                                                                         

完毕!
[root@localhost yum.repos.d]# 

在这里插入图片描述

搭建阿里云仓库(http方式外网环境)

默认的仓库文件是国外云仓库,速度比较慢,可以使用阿里云仓库代替。
步骤1、切换到 /etc/yum.repo.d/目录,将自带的仓库文件移走

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mkdir aa
[root@localhost yum.repos.d]# mv *.repo aa
[root@localhost yum.repos.d]# ls
aa
[root@localhost yum.repos.d]# 

在这里插入图片描述

步骤2、新建阿里云仓库

[root@localhost yum.repos.d]# vim ali.repo
[ali]
 name=aliyun
 #baseurl=https://mirrors.aliyun.com/centos/7/os/x86_64/         
 baseurl=https://mirrors.aliyun.com/centos/$releasever/os/$basearch/    
 gpgcheck=0
 
 [epel]                                                         
 name=epel
 baseurl=https://mirrors.aliyun.com/centos/7/extras/x86_64/
 gpgcheck=0
 
 [update]                                                        
 name=update
 baseurl=https://mirrors.aliyun.com/centos/7/updates/x86_64/
 gpgcheck=0

在这里插入图片描述
步骤3、清理缓存并安装软件。

 [root@localhost yum.repos.d]# yum clean all    //清理yum缓存
 [root@localhost yum.repos.d]# yum makecache    //重新建立元数据
 [root@localhost yum.repos.d]# yum list         //查看可安装的软件列表
 [root@localhost yum.repos.d]# yum install tree -y    //yum安装tree测试是否成功

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值