近期CentOS 5.x系列官方已经停止更新支持,同时官方也把yum源删除了,目前CentOS 5.x系统使用yum命令安装软件包基本都是失败,报错404 NotFound,因此需要更换yum源。
执行以下代码后即可恢复正常使用
cat > /etc/yum.repos.d/CentOS-Base.repo <<EOF [base] name=CentOS-$releasever - Base baseurl=http://mirrors.aliyun.com/centos-vault/5.11/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5#released updates [updates] name=CentOS-$releasever - Updates baseurl=http://mirrors.aliyun.com/centos-vault/5.11/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5#packages used/produced in the build but not released[addons] name=CentOS-$releasever - Addons baseurl=http://mirrors.aliyun.com/centos-vault/5.11/addons/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5#additional packages that may be useful[extras] name=CentOS-$releasever - Extras baseurl=http://mirrors.aliyun.com/centos-vault/5.11/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5#additional packages that extend functionality of existing packages[centosplus] name=CentOS-$releasever - Plus baseurl=http://mirrors.aliyun.com/centos-vault/5.11/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5#contrib - packages by Centos Users[contrib] name=CentOS-$releasever - Contrib baseurl=http://mirrors.aliyun.com/centos-vault/5.11/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 EOF