CentOS下yum命令详解

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

yum命令使用示例

显示yum仓库

显示所有仓库

[[email protected] ~]# yum repolist all

显示可用的仓库

[[email protected] ~]# yum repolist enabled

显示不可用的仓库

[[email protected] ~]# repolist disabled

显示应用程序包

显示所有的程序包

[[email protected] ~]# yum list[[email protected] ~]# yum list all

支持正则的查询
[[email protected] ~]# yum list tre?

CentOS下yum命令详解

显示可安装的程序包

显示所有可安装的程序包
[[email protected] ~]# yum list available

[[email protected] ~]# yum list available php

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

更新
[[email protected] ~]# yum list updates
已安装的程序包
[[email protected] ~]# yum list installed

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

[[email protected] ~]# yum list recent

安装程序包

#安装 tree 程序
[[email protected] ~]# yum install tree

升级程序包

[[email protected] ~]# yum update tree

卸载程序包

[[email protected] ~]# yum remove tree[[email protected] ~]# yum erase tree

查看程序包信息

[[email protected] ~]# yum info tree

查看文件的来源

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

[[email protected] ~]# yum provides ping

清理本地缓存

[[email protected] ~]# yum clean all 

#清楚插件缓存
[[email protected] ~]# yum clean plugins

构建缓存

[[email protected] ~]# yum makecache

搜索

[[email protected] ~]# yum search php

查看指定包所依赖的capabilities

[[email protected] ~]# yum deplist php

查看yum事务历史

[[email protected] ~]# yum history

包组相关的命令

[[email protected] ~]# yum groupinstall    # 安装包组

[[email protected] ~]# yum groupupdate     #更新包组

[[email protected] ~]# yum grouplist       #显示包组

[[email protected] ~]# yum groupremove     #移除包组

[[email protected] ~]# yum groupinfo       #查看包组信息

这些命令和上面的命令用法类似,只是针对于包组而言

相关文章: