centos6 yum 源失效问题解决办法,头疼的老机器

2022-01-04 16:24:46 浏览数 (1)

一、centos6,git1.7.1

最近上手一个老项目,登录机器一看

centos6,vim编辑器没设置

安装配置一下vim吧

git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

发现git还没发用,1.71版本

yum -y update

yum源也没法使用

这真是头疼,这么老的项目还拿出来维护干嘛,重构不得了!

二、从头开始

1.不用墨迹的了

阿里的yun源mirrors.cloud.aliyuncs.com/centos/6

清华的yum源 mirrors.tuna.tsinghua.edu.cn/centos/6

当然还有163,都无法使用了,里面只有一个readme文件,里面告诉你,centos的yum已经彻底不再维护

这不傻眼了呀

2.幸亏有个能用的

https://vault.centos.org/6.9/

进入yum源的配置文件夹:cd /etc/yum.repos.d/

把CentOS-* 全部删掉 (防止有问题可以备份下)

新建文件 CentOS-Base.repo

里面加入内容

代码语言:javascript复制
[base]
name=CentOS-6
failovermethod=priority
baseurl=https://vault.centos.org/6.9/os/x86_64/
gpgcheck=0

然后执行

yum clean all yum makecache

3.如果makecache也报错timeout等相关问题

这里也可以更换另一个可用源

.repo文件内容,全部更新为如下:版本6.6可以更换为自己需要的

代码语言:javascript复制
# 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 - Base
baseurl=http://mirrors.aliyun.com/centos-vault/6.6/os/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
[updates]
name=CentOS-6.6 - Updates
baseurl=http://mirrors.aliyun.com/centos-vault/6.6/updates/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
[extras]
name=CentOS-6.6 - Extras
baseurl=http://mirrors.aliyun.com/centos-vault/6.6/extras/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
[centosplus]
name=CentOS-6.6 - Plus
baseurl=http://mirrors.aliyun.com/centos-vault/6.6/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
[contrib]
name=CentOS-6.6 - Contrib
baseurl=http://mirrors.aliyun.com/centos-vault/6.6/contrib/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

0 人点赞