問題
LZ今天在用yum給虛擬機(jī)安裝FTP服務(wù)時(shí)發(fā)現(xiàn)yum無法正常使用,問題如下:
[root@hadoop ~]# yum install vsftpd
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: centos.ustc.edu.cn
http://centos.ustc.edu.cn/centos/6.8/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
http://ftp.sjtu.edu.cn/centos/6.8/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
http://mirror.lzu.edu.cn/centos/6.8/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.

2017-11-10_113036.png
很明顯這樣centOS的源更新了,未找到對應(yīng)的源
解決(尋找對應(yīng)centOS版本的源)
1、進(jìn)入yum源配置目錄
cd /etc/yum.repos.d
2、備份原來的yum源,便于恢復(fù)
mv CentOS-Base.repo CentOS-Base.repo.bk

2017-11-10_113445.png
注意:這里repo文件好幾個(gè),但是base最重要的,所以只需備份base即可
3、下載新的CentOS-Base.repo 到/etc/yum.repos.d/
//更新為阿里云的源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
//更新為163的源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
//更新為搜狐的源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.sohu.com/help/CentOS-Base-sohu.repo

2017-11-10_113755.png
4、運(yùn)行yum makecache生成緩存
yum clean all
yum makecache

2017-11-10_113945.png