CentOS下yum命令简述
Yum: 即Yellowdog Update Modifier,是一种基于rpm的包管理工具
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 Packages
tree.x86_64 1.6.0-10.el7 @base
还支持通配符格式的查询
显示可安装的程序包
yum list available
[vathe@localhost ~]$yum list available php
Available Packages
php.x86_64 5.4.16-42.el7 base
显示可更新或已安装的程序包
yum list updates
yum 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 scripts
Repo : base
Matched 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 graphviz
php.x86_64 : PHP scripting language for creating dynamic web sites
php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
...
查看指定包所依赖的capabilities
[vathe@localhost ~]$yum deplist php
package: php.x86_64 5.4.16-42.el7
dependency: httpd
provider: httpd.x86_64 2.4.6-45.el7.centos
...
查看yum事务历史
[root@localhost ~]# yum history
Repository 'base' is missing name in configuration, using id
ID | 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 #查看包组信息
这些命令和上面的命令用法类似,只是针对于包组而言
显示所有仓库
yum repolist all
显示可用的仓库
repolist enabled
显示可用的仓库
repolist disabled
显示所有的程序包
yum list
或
yum list all
[vathe@localhost ~]$yum list tre?
Installed Packages
tree.x86_64 1.6.0-10.el7 @base
还支持通配符格式的查询
显示可安装的程序包
yum list available
[vathe@localhost ~]$yum list available php
Available Packages
php.x86_64 5.4.16-42.el7 base
显示可更新或已安装的程序包
yum list updates
yum 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 scripts
Repo : base
Matched 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 graphviz
php.x86_64 : PHP scripting language for creating dynamic web sites
php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
...
查看指定包所依赖的capabilities
[vathe@localhost ~]$yum deplist php
package: php.x86_64 5.4.16-42.el7
dependency: httpd
provider: httpd.x86_64 2.4.6-45.el7.centos
...
查看yum事务历史
[root@localhost ~]# yum history
Repository 'base' is missing name in configuration, using id
ID | 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 #查看包组信息
这些命令和上面的命令用法类似,只是针对于包组而言
#安装 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 scripts
Repo : base
Matched 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 graphviz
php.x86_64 : PHP scripting language for creating dynamic web sites
php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
...
查看指定包所依赖的capabilities
[vathe@localhost ~]$yum deplist php
package: php.x86_64 5.4.16-42.el7
dependency: httpd
provider: httpd.x86_64 2.4.6-45.el7.centos
...
查看yum事务历史
[root@localhost ~]# yum history
Repository 'base' is missing name in configuration, using id
ID | 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 #查看包组信息
这些命令和上面的命令用法类似,只是针对于包组而言
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 scripts
Repo : base
Matched 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 graphviz
php.x86_64 : PHP scripting language for creating dynamic web sites
php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
...
查看指定包所依赖的capabilities
[vathe@localhost ~]$yum deplist php
package: php.x86_64 5.4.16-42.el7
dependency: httpd
provider: httpd.x86_64 2.4.6-45.el7.centos
...
查看yum事务历史
[root@localhost ~]# yum history
Repository 'base' is missing name in configuration, using id
ID | 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 #查看包组信息
这些命令和上面的命令用法类似,只是针对于包组而言
查看某一文件来自于那个程序包
[vathe@localhost ~]$yum provides /bin/mv
coreutils-8.22-18.el7.x86_64 : A set of basic GNU tools commonly used in shell scripts
Repo : base
Matched 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 graphviz
php.x86_64 : PHP scripting language for creating dynamic web sites
php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
...
查看指定包所依赖的capabilities
[vathe@localhost ~]$yum deplist php
package: php.x86_64 5.4.16-42.el7
dependency: httpd
provider: httpd.x86_64 2.4.6-45.el7.centos
...
查看yum事务历史
[root@localhost ~]# yum history
Repository 'base' is missing name in configuration, using id
ID | 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 #查看包组信息
这些命令和上面的命令用法类似,只是针对于包组而言
yum makecache
[vathe@localhost ~]$yum search php
============================================== N/S matched: php ===============================================
graphviz-php.x86_64 : PHP extension for graphviz
php.x86_64 : PHP scripting language for creating dynamic web sites
php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
...
查看指定包所依赖的capabilities
[vathe@localhost ~]$yum deplist php
package: php.x86_64 5.4.16-42.el7
dependency: httpd
provider: httpd.x86_64 2.4.6-45.el7.centos
...
查看yum事务历史
[root@localhost ~]# yum history
Repository 'base' is missing name in configuration, using id
ID | 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 #查看包组信息
这些命令和上面的命令用法类似,只是针对于包组而言
[vathe@localhost ~]$yum deplist php
package: php.x86_64 5.4.16-42.el7
dependency: httpd
provider: httpd.x86_64 2.4.6-45.el7.centos
...
[root@localhost ~]# yum history
Repository 'base' is missing name in configuration, using id
ID | 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 #查看包组信息
这些命令和上面的命令用法类似,只是针对于包组而言
yum groupinstall # 安装包组
yum groupupdate #更新包组
yum grouplist #显示包组
yum groupremove #移除包组
yum groupinfo #查看包组信息
这些命令和上面的命令用法类似,只是针对于包组而言
更多YUM相关教程见以下内容:
RHEL7 本地yum源配置 http://www.linuxidc.com/Linux/2017-01/139140.htm
CentOS 6.5 配置本地Yum源 http://www.linuxidc.com/Linux/2017-04/143127.htm
CentOS 7 使用阿里云的yum源、PIP源 http://www.linuxidc.com/Linux/2017-01/13966.htm
CentOS及Red Hat Linux安装yum源 http://www.linuxidc.com/Linux/2017-02/140205.htm
CentOS 7更改yum源与更新系统 http://www.linuxidc.com/Linux/2017-01/140067.htm
RedHat7.0配置本地yum源 http://www.linuxidc.com/Linux/2017-01/139148.htm
RedHat Linux 7安装CentOS 7 yum源 http://www.linuxidc.com/Linux/2017-04/142444.htm
软件包管理之前端管理工具yum http://www.linuxidc.com/Linux/2017-02/140270.htm
CentOS 7 使用阿里云的yum源、PIP源 http://www.linuxidc.com/Linux/2017-01/13966.htm
Linux yum的配置使用和程序包的编译安装 http://www.linuxidc.com/Linux/2017-09/146903.htm
本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-10/148090.htm