YUM : Yellowdog Update Modifier ,rpm 的前端程序,可解决软件包相关依赖性,可在多个库之间定位软件包,up2date的替代工具。
yum 客户端配置文件:
etc/yum.conf :为所有仓库提供公共配置
/etc/yum.repos.d/*.repo :为仓库的指向提供配置
仓库指向的定义:
[repositoryID]
name=Some name for this repository
baseurl=url://path/to/repository/
enabled={1|0}
gpgcheck={1|0}
gpgkey=URL
enablegroups={1|0}
failovermethod={roundrobin|priority}
roundrobin: : 意为随机挑选,默认值
priority: 按顺序访问
cost= 默认为1000
yum 的repo 配置文件中可用的变量:
$releasever:当前OS的发行版的主版本号$arch: 平台,i386,i486,i586,x86_64等
$basearch :基础平台;i386, x86_64
$YUM0-$YUM9:自定义变量
yum源
阿里云repo 文件:
http://mirrors.aliyun.com/repo/
阿里CentOS系统的yum源
https://mirrors.aliyun.com/centos/$releasever/os/x86_64/
阿里云:EPEL 的yum
https://mirrors.aliyun.com/epel/$releasever/x86_64
yum 命令的用法:
yum [options] [command] [package ...]
显示仓库列表:
yum repolist [all|enabled|disabled]
显示程序包:
yum list
yum list [all | glob_exp1] [glob_exp2] [...]
yum list {available|installed|updates} [glob_exp1][...]
安装程序包:
yum install package1 [package2] [...]
yum reinstall package1 [package2] [...] (重新安装)
升级程序包:
yum update [package1] [package2] [...]
yum downgrade package1 [package2] [...] ( 降级)
检查可用升级:
yum check-update
卸载程序包:
yum remove | erase package1 [package2] [...]
查看程序包information:
yum info [...]
查看指定的特性(可以是某文件)是由哪个程序包所提供:
yum provides | whatprovides feature1 [feature2][...]
清理本地缓存:
清除/var/cache/yum/$basearch/$releasever
缓存
yum clean [ packages | metadata | expire-cache |rpmdb | plugins | all ]
构建缓存:
yum makecache
搜索:yum search string1 [string2] [...]
以指定的关键字搜索程序包名及summary
信息
查看指定包所依赖的capabilities
yum deplist package1 [package2] [...]
查看yum 事务历史:
yum history [info|list|packages-list|packages-info|
summary|addon-info|redo|undo|
rollback|new|sync|stats]
yum history
yum history info 6
yum history undo 6
日志 :/var/log/yum.log
安装及升级本地程序包:
yum localinstall rpmfile1 [rpmfile2] [...]
( 用install 替代)
yum localupdate rpmfile1 [rpmfile2] [...]
( 用update 替代)
包组管理的相关命令:
yum groupinstall group1 [group2] [...]
yum groupupdate group1 [group2] [...]
yum grouplist [hidden] [groupwildcard] [...]
yum groupremove group1 [group2] [...]
yum groupinfo group1 [...]
yum 的命令行选项:
--nogpgcheck :禁止进行gpg check
-y: 自动回答为“yes”
-q :静默模式
--disablerepo=repoidglob :临时禁用此处指定的repo
--enablerepo=repoidglob :临时启用此处指定的repo
--noplugins
创建yum 仓库:
createrepo [options] <directory>