背景
centos6操作系统版本已经结束了生命周期(EOL),linux社区已经不再维护该操作系统的版本建议升级操作系统至centos7如果生产中业务过度期仍需要使用centos6系统中的一些安装包,请按照下文切换centos6的yum源2020年11月30日CentOS6EOL。按照社区规则CentOS6的源地址http://mirror.centos.org/centos-6/内容已移除目前第三方的镜像站中均已移除CentOS6的源。阿里云的源http://mirrors.cloud.aliyuncs.com和http://mirrors.aliyun.com也无法同步到CentOS6的源。当您在阿里云上继续使用默认配置的CentOS6的源会发生报错。报错示例如下图所示:
解决办法:
直接在linux命令行执行以下代码即可
cat >> /etc/yum.repos.d/CentOS-aliyun-lhr.repo <<“EOF” [base] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/
b
a
s
e
a
r
c
h
/
g
p
g
c
h
e
c
k
=
1
g
p
g
k
e
y
=
h
t
t
p
:
/
/
m
i
r
r
o
r
s
.
a
l
i
y
u
n
.
c
o
m
/
c
e
n
t
o
s
−
v
a
u
l
t
/
R
P
M
−
G
P
G
−
K
E
Y
−
C
e
n
t
O
S
−
6
[
u
p
d
a
t
e
s
]
n
a
m
e
=
C
e
n
t
O
S
−
6.10
e
n
a
b
l
e
d
=
1
f
a
i
l
o
v
e
r
m
e
t
h
o
d
=
p
r
i
o
r
i
t
y
b
a
s
e
u
r
l
=
h
t
t
p
:
/
/
m
i
r
r
o
r
s
.
a
l
i
y
u
n
.
c
o
m
/
c
e
n
t
o
s
−
v
a
u
l
t
/
6.10
/
u
p
d
a
t
e
s
/
basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 [updates] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/
basearch/gpgcheck=1gpgkey=http://mirrors.aliyun.com/centos−vault/RPM−GPG−KEY−CentOS−6[updates]name=CentOS−6.10enabled=1failovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos−vault/6.10/updates/basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.comm/centos-vault/RPM-GPG-KEY-CentOS-6 [extras] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6 [epel] name=Extra Packages for Enterprise Linux 6 -
b
a
s
e
a
r
c
h
e
n
a
b
l
e
d
=
1
f
a
i
l
o
v
e
r
m
e
t
h
o
d
=
p
r
i
o
r
i
t
y
b
a
s
e
u
r
l
=
h
t
t
p
:
/
/
m
i
r
r
o
r
s
.
a
l
i
y
u
n
.
c
o
m
/
e
p
e
l
−
a
r
c
h
i
v
e
/
6
/
basearch enabled=1 failovermethod=priority baseurl=http://mirrors.aliyun.com/epel-archive/6/
basearchenabled=1failovermethod=prioritybaseurl=http://mirrors.aliyun.com/epel−archive/6/basearch gpgcheck=0 gpgkey=http://mirrors.aliyun.com/epel-archive/RPM-GPG-KEY-EPEL-6 EOF cat >> /etc/yum.repos.d/CentOS-neusoft-lhr.repo <<“EOF” [base] name=CentOS-6-Base baseurl=http://mirrors.neusoft.edu.cn/centos/6/os/
b
a
s
e
a
r
c
h
/
g
p
g
c
h
e
c
k
=
1
g
p
g
k
e
y
=
h
t
t
p
:
/
/
m
i
r
r
o
r
.
c
e
n
t
o
s
.
o
r
g
/
c
e
n
t
o
s
/
R
P
M
−
G
P
G
−
K
E
Y
−
C
e
n
t
O
S
−
6
[
u
p
d
a
t
e
s
]
n
a
m
e
=
C
e
n
t
O
S
−
6
−
U
p
d
a
t
e
s
b
a
s
e
u
r
l
=
h
t
t
p
:
/
/
m
i
r
r
o
r
s
.
n
e
u
s
o
f
t
.
e
d
u
.
c
n
/
c
e
n
t
o
s
/
6
/
u
p
d
a
t
e
s
/
basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 [updates] name=CentOS-6-Updates baseurl=http://mirrors.neusoft.edu.cn/centos/6/updates/
basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM−GPG−KEY−CentOS−6[updates]name=CentOS−6−Updatesbaseurl=http://mirrors.neusoft.edu.cn/centos/6/updates/basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 [extras] name=CentOS-6-Extras baseurl=http://mirrors.neusoft.edu.cn/centos/6/extras/
b
a
s
e
a
r
c
h
/
g
p
g
c
h
e
c
k
=
1
g
p
g
k
e
y
=
h
t
t
p
:
/
/
m
i
r
r
o
r
.
c
e
n
t
o
s
.
o
r
g
/
c
e
n
t
o
s
/
R
P
M
−
G
P
G
−
K
E
Y
−
C
e
n
t
O
S
−
6
[
c
e
n
t
o
s
p
l
u
s
]
n
a
m
e
=
C
e
n
t
O
S
−
6
−
P
l
u
s
b
a
s
e
u
r
l
=
h
t
t
p
:
/
/
m
i
r
r
o
r
s
.
n
e
u
s
o
f
t
.
e
d
u
.
c
n
/
c
e
n
t
o
s
/
6
/
c
e
n
t
o
s
p
l
u
s
/
basearch/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 [centosplus] name=CentOS-6-Plus baseurl=http://mirrors.neusoft.edu.cn/centos/6/centosplus/
basearch/gpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM−GPG−KEY−CentOS−6[centosplus]name=CentOS−6−Plusbaseurl=http://mirrors.neusoft.edu.cn/centos/6/centosplus/basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 [contrib] name=CentOS-6-Contrib baseurl=http://mirrors.neusoft.edu.cn/centos/6/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 [epel] name=Extra Packages for Enterprise Linux 6 -
b
a
s
e
a
r
c
h
e
n
a
b
l
e
d
=
1
f
a
i
l
o
v
e
r
m
e
t
h
o
d
=
p
r
i
o
r
i
t
y
b
a
s
e
u
r
l
=
h
t
t
p
:
/
/
m
i
r
r
o
r
s
.
n
e
u
s
o
f
t
.
e
d
u
.
c
n
/
e
p
e
l
/
6
/
basearch enabled=1 failovermethod=priority baseurl=http://mirrors.neusoft.edu.cn/epel/6/
basearchenabled=1failovermethod=prioritybaseurl=http://mirrors.neusoft.edu.cn/epel/6/basearch gpgcheck=0 gpgkey=http://mirrors.neusoft.edu.cn/epel/RPM-GPG-KEY-EPEL-6 EOF