格式:yum [options] [command] [package …]
-y:程序安装前不需要人工确认直接安装
-q:静默安装
[command]
repolist [all|enabled|disabled]:显示仓库列表(默认为enable);第一次运行是会下载源数据并列出可用仓库列表
list […]:显示所有程序包列表 #指定程序包为查看安装状态
available:显示未安装的程序包
installed:显示已安装的程序包
updates:显示可用的程序更新包
grouplist […]:显示所有程序包组列表
available:显示未安装的程序包组
installed:显示已安装的程序包组
updates:显示可用的程序更新包组
install package1 [package2] […]:安装程序包;可一次安装多程序包;
groupinstall group1 [group2] […]:安装程序包组;可一次安装多程序包组
update [package1] [package2] […]:更新程序包;可一次更新多程序包;
groupupdate group1 [group2] […]:更新程序包组;可一次更新多程序包组;
check-update:检查可更新的程序包
makecache:构建仓库本地缓存
clean all:清理本地所有缓存
-y:程序安装前不需要人工确认直接安装
-q:静默安装
[command]
repolist [all|enabled|disabled]:显示仓库列表(默认为enable);第一次运行是会下载源数据并列出可用仓库列表
list […]:显示所有程序包列表 #指定程序包为查看安装状态
available:显示未安装的程序包
installed:显示已安装的程序包
updates:显示可用的程序更新包
grouplist […]:显示所有程序包组列表
available:显示未安装的程序包组
installed:显示已安装的程序包组
updates:显示可用的程序更新包组
install package1 [package2] […]:安装程序包;可一次安装多程序包;
groupinstall group1 [group2] […]:安装程序包组;可一次安装多程序包组
update [package1] [package2] […]:更新程序包;可一次更新多程序包;
groupupdate group1 [group2] […]:更新程序包组;可一次更新多程序包组;
check-update:检查可更新的程序包
makecache:构建仓库本地缓存
clean all:清理本地所有缓存
repolist [all|enabled|disabled]:显示仓库列表(默认为enable);第一次运行是会下载源数据并列出可用仓库列表
[root@localhost ~]# yum repolist Loaded plugins: fastestmirror Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast Determining fastest mirrors * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.com repo id repo name status !base/7/x86_64 CentOS-7 - Base 9,363 !extras/7/x86_64 CentOS-7 - Extras 381 !updates/7/x86_64 CentOS-7 - Updates 1,881 repolist: 11,625
list […]:显示所有程序包列表 #指定程序包为查看安装状态
[root@localhost ~]# yum list openssh Loaded plugins: fastestmirror Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.com Installed Packages openssh.x86_64 6.6.1p1-22.el7 @anaconda Available Packages openssh.x86_64 6.6.1p1-35.el7_3 updates
install package1 [package2] […]:安装程序包;可一次安装多程序包(包之间用空格隔开);
[root@localhost ~]# yum install wget Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.cn99.com * extras: centos.ustc.edu.cn * updates: centos.ustc.edu.cn Resolving Dependencies --> Running transaction check ---> Package wget.x86_64 0:1.14-15.el7_4.1 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================================== Package Arch Version Repository Size ================================================================================================================================================== Installing: wget x86_64 1.14-15.el7_4.1 base 547 k Transaction Summary ================================================================================================================================================== Install 1 Package Total download size: 547 k Installed size: 2.0 M Is this ok [y/d/N]: y Downloading packages: wget-1.14-15.el7_4.1.x86_64.rpm | 547 kB 00:00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : wget-1.14-15.el7_4.1.x86_64 1/1 Verifying : wget-1.14-15.el7_4.1.x86_64 1/1 Installed: wget.x86_64 0:1.14-15.el7_4.1 Complete!