CentOS: yum, dnf
yum: 由yellow dog研发,Yellow dog Update Modifier
yum repository:
- yum repo,存储了众多的rpm包,以及包的相关的元数据文件(放置于特定的目录下:repodata,repodata的路径即为配置文件中yum源的路径)
- 文件服务器
- ftp://
- http://
- nfs://
- file:///
yum客户端:
- 配置文件:
- /etc/yum.conf:为所有仓库提供公共配置
- /etc/yum.repos.d/*.repo:为仓库的指向提供配置
- 仓库指向的定义
[repositoryID]
name=Some name for this repository
baseurl=path to repository
enabled={1 | 0}
gpgcheck={1 | 0}
gpgkey=URL
enablegroups={1 | 0}
failovermethod={roundrobin | priority},默认为roundrobin,意为随机
cost=number,默认为1000
注意:等号左右没有空格
yum命令的用法:
- yum [options] [command] [package ...]
- 显示仓库列表:repolist [all | enabled | disabled]
- 显示程序包:list
- yum list [all | global_exp1] [global_exp2] [...]
- yum list available | installed | updates [global_exp1] [...]
- 安装程序包:install package1 [package2] [...]
- 升级程序包:update package1 [package2] [...]
- 检查可用升级:check-update
- 卸载程序包:remove | erase package1 [package2] [...],卸载时,依赖于此包的包也会被卸载
- 查看程序包的信息:info package-name
- 查看特性由哪个程序包提供:provides | whatprovides feature1 [feature2] [...]
- 清理本地缓存:clean [packages | metadata | expire-cache | rpmdb | plugins | all]
- 构建缓存:makecache
- 搜索:search string1 [string2] [...],模糊搜索包名或summary信息
- 重新安装:reinstall package1 [package2] [...]
- 降级程序包:downgrade package1 [package2] [...]
- 查看指定包所依赖的capabilities:deplist package1 [package2] [...]
- 查看yum的事务历史:history [options]
- 安装及升级本地程序包:
- localinstall rpmfile1 [rpmfile2] [...]
- localupdate rpmfile1 [rpmfile2] [...]
- 现在已经不建议使用,直接用install/update加rpm包名即可
- 包组管理的相关命令
- groupinstall [group1] [group2] [...]
- groupupdate [group1] [group2] [...]
- grouplist [hidden] [groupwildcard] [...]
- groupremove [group1] [group2] [...]
- groupinfo [group1] [group2] [...]