yum --disablerepo=reponame # 禁用源@H_404_1@
yum --enablerepo=reponame # 启用源@H_404_1@
@H_404_1@
@H_404_1@
# 查看可用的源@H_404_1@
[test@localhost ~]$ yum repolist@H_404_1@
Loaded plugins: fastestmirror,security@H_404_1@
Determining fastest mirrors@H_404_1@
.....省略....@H_404_1@
repo id repo name status@H_404_1@
base CentOS-6 - Base 6,696@H_404_1@
c6-media CentOS-6 - Media 6,575@H_404_1@
extras CentOS-6 - Extras 60@H_404_1@
updates CentOS-6 - Updates 94@H_404_1@
repolist: 13,425@H_404_1@
@H_404_1@
# 只是用本地yum源来安装@H_404_1@
[test@localhost etc]$ sudo yum --disablerepo='*' --enablerepo=c6-media install PHP@H_404_1@
Loaded plugins: fastestmirror,security@H_404_1@
Setting up Install Process@H_404_1@
Loading mirror speeds from cached hostfile@H_404_1@
* c6-media: <--------注意@H_404_1@
Resolving Dependencies@H_404_1@
--> Running transaction check@H_404_1@
# 以上还可写作@H_404_1@
[test@localhost etc]$ sudo yum --disablerepo=* --enablerepo=c6-media install PHP@H_404_1@
Loaded plugins: fastestmirror,security@H_404_1@
Setting up Install Process@H_404_1@
Loading mirror speeds from cached hostfile@H_404_1@
* c6-media: <--------注意与之前输出的区别@H_404_1@
Resolving Dependencies@H_404_1@
--> Running transaction check@H_404_1@
@H_404_1@
# 除了指定的源,其他存在的源也会启用@H_404_1@
[test@localhost etc]$ sudo yum --enablerepo=c6-media install PHP @H_404_1@
[sudo] password for test:@H_404_1@
Loaded plugins: fastestmirror,security@H_404_1@
Setting up Install Process@H_404_1@
Loading mirror speeds from cached hostfile@H_404_1@
* base: mirrors.yun-idc.com <------注意与之前输出的区别@H_404_1@
* c6-media:@H_404_1@
* extras: mirrors.yun-idc.com@H_404_1@
* updates: mirrors.yun-idc.com@H_404_1@
Resolving Dependencies@H_404_1@
--> Running transaction check@H_404_1@
@H_404_1@
# 所有的源都被禁用@H_404_1@
[test@localhost etc]$ sudo yum --disablerepo='*' install PHP @H_404_1@
Loaded plugins: fastestmirror,security@H_404_1@
Setting up Install Process@H_404_1@
Loading mirror speeds from cached hostfile@H_404_1@
No package PHP available. <------注意与之前输出的区别@H_404_1@
Error: Nothing to do@H_404_1@