yum命令

1.yum命令

yum是一个软件包管理器,

yum是查找、安装、删除某一个、一组甚至全部软件包的命令。

自动处理依赖性关系,并且一次安装所有依赖的软体包。


2.yum命令的使用方法

yum list //列出可用rpm包

yum grouplist //列出rpm包组

yum install -y 包名 //安装指定包

yum groupinstall 组名 //安装指定包组

yum search  关键字 //搜索包,不精准很全面,描述包含关键字也会列出来。

yum remove  包名 //卸载指定包

yum update [包名] //不加包名全部升级包括系统,加包名升级指定包

yum provides "/*/文件名" //搜索文件来自哪个包安装。


3.实例

3.1 yum安装一个软件

# yum install -y vim


3.2 查看yum软件列表和搜索

列表:

可以进行筛选,后面带@符号的,说明是安装过的。

# yum list |grep vim

vim-common.x86_64                           2:7.4.160-2.el7            @base

vim-enhanced.x86_64                         2:7.4.160-2.el7            @base

vim-filesystem.x86_64                       2:7.4.160-2.el7            @base

vim-minimal.x86_64                          2:7.4.160-2.el7            @anaconda

protobuf-vim.x86_64                         2.5.0-8.el7                base

vim-X11.x86_64                              2:7.4.160-2.el7            base


搜索:

搜索会把描述里面含有关键字的包也搜出来。

# yum search vim

protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers descriptions

vim-X11.x86_64 : The VIM version of the vi editor for the X Window System

vim-common.x86_64 : The common files needed by any version of the VIM editor


3.3 搜索命令应该安装哪个包

如果没有wget命令,搜出来的结果是,一个来自base源,一个是updates源升级。也就是说直接yum install wget即可。

# yum provides "/*/wget"

wget-1.14-15.el7.x86_64 : A utility for retrieving files using the HTTP or FTP protocols

源    :base

匹配来源:

文件名    :/usr/bin/wget


wget-1.14-15.el7_4.1.x86_64 : A utility for retrieving files using the HTTP or FTP protocols

源    :updates

匹配来源:

文件名    :/usr/bin/wget


猜你喜欢

转载自blog.51cto.com/11060853/2105025