CentOS6服务器数据源失效处理
最近在一些老的服务器上处理事情的时候,发现yum安装失败,文件404。猜测可能是数据源失效了。报错如下:
Total download size: 156 k Installed size: 340 k Downloading Packages: https://mirrors.aliyun.com/centos-vault/6.8/os/x86_64/Packages/vsftpd-2.2.2-24.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found" Trying other mirror. To address this issue please refer to the below knowledge base article
查了下资料,先备份原来的数据源:
cd /etc/yum.repos.d cp CentOS-Base.repo CentOS-Base.repo.bak cp epel.repo epel.repo.bak
修改为CentOS-Base.repo
# CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-6/6.10 - Base - mirrors.aliyun.com failovermethod=priority baseurl=https://mirrors.aliyun.com/centos-vault/6.8/os/$basearch/ gpgcheck=1 gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-6/6.10 - Updates - mirrors.aliyun.com failovermethod=priority baseurl=https://mirrors.aliyun.com/centos-vault/6.8/updates/$basearch/ gpgcheck=1 gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-6/6.10 - Extras - mirrors.aliyun.com failovermethod=priority baseurl=https://mirrors.aliyun.com/centos-vault/6.8/extras/$basearch/ gpgcheck=1 gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-6/6.10 - Plus - mirrors.aliyun.com failovermethod=priority baseurl=https://mirrors.aliyun.com/centos-vault/6.8/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-6/6.10 - Contrib - mirrors.aliyun.com failovermethod=priority baseurl=https://mirrors.aliyun.com/centos-vault/6.8/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
修改epel.repo为
[epel] name=Extra Packages for Enterprise Linux 6 - $basearch enabled=1 failovermethod=priority baseurl=http://mirrors.sohu.com/fedora-epel/6/$basearch gpgcheck=0 gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-6
完成后,一定要清除缓存,再重建:
yum clean all yum makecache