yum(Yellowdog Updater, Modified)是 CentOS / RHEL / Fedora 等早期版本 中常用的 RPM 包管理工具,主要用于安装、更新、删除软件包。下面按常见使用场景给你一个实用速查表。
yum [选项] [命令] [包名]
yum search nginx # 搜索软件包
yum list # 列出所有可用包
yum list installed # 已安装的包
yum info nginx # 查看包信息
yum install nginx
yum install -y nginx # 自动确认(非交互)
yum update # 更新所有软件包
yum update nginx # 只更新指定包
yum check-update # 查看可更新的包
yum remove nginx
yum erase nginx # 和 remove 一样
yum clean all # 清理所有缓存
yum makecache # 重建缓存
yum deplist nginx
yum provides /usr/bin/vim
yum provides "*/ifconfig"
yum history
yum history undo 3 # 撤销第 3 次操作
yum repolist
yum repolist all
yum --disablerepo=epel install xxx
yum --enablerepo=epel install xxx
yum install epel-release
很多软件在 EPEL 仓库 中
ping mirrors.aliyun.com
yum clean all
yum makecache
yum 已被 dnf 取代
dnf install nginx
但 yum 仍可作为 dnf 的兼容命令使用。
yum install -y wget curl vim
yum update -y
yum remove -y docker
| 功能 | 命令 |
|---|---|
| 安装 | yum install |
| 删除 | yum remove |
| 更新 | yum update |
| 搜索 | yum search |
| 查看信息 | yum info |
| 清理缓存 | yum clean all |
如果你愿意,可以告诉我:
我可以给你精确命令和仓库配置。