问题
LZ今天在用yum给虚拟机安装FTP服务时发现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.

很明显这样centOS的源更新了,未找到对应的源
解决(寻找对应centOS版本的源)
1、进入yum源配置目录
cd /etc/yum.repos.d
2、备份原来的yum源,便于恢复
mv CentOS-Base.repo CentOS-Base.repo.bk

注意:这里repo文件好几个,但是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

4、运行yum makecache生成缓存
yum clean all
yum makecache

网友评论