Linux---(2)CentOS下yum命令详解

来源:互联网 发布:淘宝联盟-阿里妈妈 编辑:程序博客网 时间:2024/05/20 16:13

本文转载自:click

CentOS下yum命令详解

Yum: 即Yellowdog Update Modifier,是一种基于rpm的包管理工具

yum命令使用示例

显示yum仓库

显示所有仓库

yum repolist all

显示可用的仓库

repolist enabled

显示可用的仓库

repolist disabled

显示应用程序包

显示所有的程序包

yum list 或yum list all[vathe@localhost ~]$yum list tre?Installed Packagestree.x86_64                                         1.6.0-10.el7                                          @base还支持通配符格式的查询

显示可安装的程序包

yum list available[vathe@localhost ~]$yum list available phpAvailable Packagesphp.x86_64                                          5.4.16-42.el7                                          base

显示可更新或已安装的程序包

yum list updatesyum list installed

显示仓库中最近增加的程序包

yum list recent

安装程序包

#安装 tree 程序yum install tree

升级程序包

yum update tree

卸载程序包

yum remove tree或yum erase tree

查看程序包信息

yum info tree

查看文件的来源

查看某一文件来自于那个程序包

[vathe@localhost ~]$yum provides /bin/mv coreutils-8.22-18.el7.x86_64 : A set of basic GNU tools commonly used in shell scriptsRepo        : baseMatched from:Filename    : /bin/mv#表示/bin/mv文件来自于coreutils-8.22-18.el7.x86_64程序包

清理本地缓存

yum clean all #清楚插件缓存yum clean plugins

构建缓存

yum makecache

搜索

[vathe@localhost ~]$yum search php============================================== N/S matched: php ===============================================graphviz-php.x86_64 : PHP extension for graphvizphp.x86_64 : PHP scripting language for creating dynamic web sitesphp-bcmath.x86_64 : A module for PHP applications for using the bcmath library...

查看指定包所依赖的capabilities

[vathe@localhost ~]$yum deplist phppackage: php.x86_64 5.4.16-42.el7  dependency: httpd   provider: httpd.x86_64 2.4.6-45.el7.centos...

查看yum事务历史

[root@localhost ~]# yum historyRepository 'base' is missing name in configuration, using idID     | Login user               | Date and time    | Action(s)      | Altered-------------------------------------------------------------------------------     2 | Vathe Su <vathe>         | 2017-04-17 17:07 | Install        |    1        1 | System <unset>           | 2017-03-23 22:19 | Install        | 1405   history list

包组相关的命令

yum groupinstall    # 安装包组yum groupupdate     #更新包组yum grouplist       #显示包组yum groupremove     #移除包组yum groupinfo       #查看包组信息这些命令和上面的命令用法类似,只是针对于包组而言