常用YUM命令及选项详解 您所在的位置:网站首页 常用终端命令及含义 常用YUM命令及选项详解

常用YUM命令及选项详解

2024-07-02 12:39| 来源: 网络整理| 查看: 265

查询功能 查询YUM服务器上所有可安装的软件包列表。 [root@localhost ~]# yum list #查询所有可安装软件包列表 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Installed Packages #已经安装的软件包 GeoIP.x86_64 1.5.0-13.el7 @anaconda NetworkManager.x86_64 1:1.12.0-6.el7 @anaconda ...省略部分输出... Available Packages #还可以安装的软件包 389-ds-base.x86_64 1.3.8.4-15.el7 c7-media 389-ds-base-libs.x86_64 1.3.8.4-15.el7 c7-media #软件名 版本 所在位置(base名称) ...省略部分输出... 查询yum源服务器中是否包含某个软件包。 [root@localhost ~]# yum list 包名 #查询单个软件包

例如:

[root@localhost ~]# yum list samba Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Available Packages samba.x86_64 4.8.3-4.el7 c7-medi 搜索yum源服务器上所有和关键字相关的软件包。 [root@localhost ~]# yum search 关键字 #搜索服务器上所有和关键字相关的软件包

例如:

[root@localhost ~]# yum search samba #搜索服务器上所有和samba相关的软件包 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile ========================================== N/S matched: samba =========================================== samba-client.x86_64 : Samba client programs samba-client-libs.x86_64 : Samba client libraries ...省略部分输出... Name and summary matches only, use "search all" for everything. 查询指定软件包的信息。 [root@localhost ~]# yum search 包名 #查询指定软件包的信息

例如:

[root@localhost ~]# yum info samba #查询samba软件包的信息 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Available Packages ←还没有安装 Name : samba ←包名 Arch : x86_64 ←适合的硬件平台 Version : 4.8.3 ←版本 Release : 4.el7 ←发布版本 Size : 680 k ←大小 Repo : c7-media ←软件包源地址 Summary : Server and Client software to interoperate with Windows machines URL : http://www.samba.org/ License : GPLv3+ and LGPLv3+ Description : Samba is the standard Windows interoperability suite of programs for Linux and : Unix. 安装 [root@study ~]# yum [选项] [相关参数] 选项说明install后面接要安装的软件!-y自动回答 yes,如果不加-y,那么每个安装的软件都需要手工回答 yes–installroot=/some/path将该软件安装在 /some/path 而不使用默认路径;

我们来安装一个软件包,看看具体的安装过程是怎么样的,命令如下:

[root@localhost ~]# yum install pam-devel Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile #上面的几行在找出最快的 yum server Resolving Dependencies #接下来先处理『属性相依』的软件问题 --> Running transaction check ---> Package pam-devel.x86_64 0:1.1.8-22.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved #下面是一个总结性的表格 ========================================================================================================= Package Arch Version Repository Size ========================================================================================================= Installing: pam-devel x86_64 1.1.8-22.el7 c7-media 184 k Transaction Summary ========================================================================================================= Install 1 Package #←要安装1个软件包 Total download size: 184 k #←总共需要下载的资源大小 Installed size: 528 k #←安装大小 Is this ok [y/d/N]: Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : pam-devel-1.1.8-22.el7.x86_64 1/1 Verifying : pam-devel-1.1.8-22.el7.x86_64 1/1 Installed: pam-devel.x86_64 0:1.1.8-22.el7 Complete! 升级 [root@localhost ~]# yum -y update 包名 #升级指定的软件包 选项说明update升级-y自动回答yes

注意:在进行升级操作时,yum源服务器中软件包的版本要比本机安装的软件包的版本高。

[root@localhost ~]# yum -y update #升级本机所有软件包

这条命令会升级系统中所有的软件包。不过我们的生成服务器是稳定优先的,所以这种全系统升级的情况并不多见。

卸载

再次强调一下,除非你确定卸载的软件的依赖包不会对系统产生影响,否则不要只想yum的卸载,因为很可能在卸载软件包的同时卸载的依赖包也是重要的系统文件,这就有可能导致系统崩溃,卸载命令如下:

[root@localhost ~]# yum remove 包名 #卸载指定的软件包


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有