问题
centos6被废弃了,网易的镜像(http://mirrors.163.com)不提供了
查看并卸载以前安装包
# 查看
rpm -qa | grep yum
# 卸载所有相关的yum包,直到用查看命令查看时没有yum相关包
rpm -e --nodeps yum-package
安装
查看系统版本
cat /etc/system-release
我的版本是redhat 6.7
进入对应的目录下载以下几个文件
wget https://vault.centos.org/6.7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
wget https://vault.centos.org/6.7/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget https://vault.centos.org/6.7/os/x86_64/Packages/yum-3.2.29-69.el6.centos.noarch.rpm
wget https://vault.centos.org/6.7/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
安装下载的文件
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-3.2.29-69.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
修改源文件
没找到https://vault.centos.org中的CentOS-Base.repo,我们用阿里云的,然后修改下
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
- http://mirrors.aliyun.com/centos替换成https://vault.centos.org
- $releasever替换成6.7
- 删除releasever
修改后的文件如下
#
# 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.7 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=https://vault.centos.org/6.7/os/$basearch/
gpgcheck=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-6.7 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=https://vault.centos.org/6.7/updates/$basearch/
gpgcheck=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6.7 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=https://vault.centos.org/6.7/extras/$basearch/
gpgcheck=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.7 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=https://vault.centos.org/6.7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.7 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=https://vault.centos.org/6.7/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-6
清理并重新加载缓存
yum clean all
yum makecache
看到下面的情形就是配置好了