修复CentOS 6软件仓库配置

CentOS 6发行版repo修复

由于CentOS已经停止CentOS 6的更新,所有旧版本软件包都归档到 https:://vault.centos.org ,所以需要修改系统 /etc/yum.repo.d 目录下的配置文件,指定从 https:://vault.centos.org 下载更新,类似如下:

cp -r /etc/yum.repos.d /etc/yum.repos.d.bak
cd /etc/yum.repos.d
sed -i 's/^mirrorlist=/#mirrorlist=/g' *.repo
sed -i 's/^#baseurl=/baseurl=/g' *.repo
sed -i 's/http:\/\/mirror.centos.org\/centos/https:\/\/vault.centos.org/g' *.repo
sed -i 's/$releasever/6.10/g' *.repo

修复后后配置主要修订内容案例如下( 以 CentOS-Base.repo 为例):

[base]
name=CentOS-6.10 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=6.10&arch=$basearch&repo=os&infra=$infra
baseurl=https://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
...

完整的配置文件如下

  • CentOS-Base.repo :

fix_centos6_repo/CentOS-Base.repo
 1# CentOS-Base.repo
 2#
 3# The mirror system uses the connecting IP address of the client and the
 4# update status of each mirror to pick mirrors that are updated to and
 5# geographically close to the client.  You should use this for CentOS updates
 6# unless you are manually picking other mirrors.
 7#
 8# If the mirrorlist= does not work for you, as a fall back you can try the 
 9# remarked out baseurl= line instead.
10#
11#
12
13[base]
14name=CentOS-6.10 - Base
15#mirrorlist=http://mirrorlist.centos.org/?release=6.10&arch=$basearch&repo=os&infra=$infra
16baseurl=https://vault.centos.org/6.10/os/$basearch/
17gpgcheck=1
18gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
19
20#released updates 
21[updates]
22name=CentOS-6.10 - Updates
23#mirrorlist=http://mirrorlist.centos.org/?release=6.10&arch=$basearch&repo=updates&infra=$infra
24baseurl=https://vault.centos.org/6.10/updates/$basearch/
25gpgcheck=1
26gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
27
28#additional packages that may be useful
29[extras]
30name=CentOS-6.10 - Extras
31#mirrorlist=http://mirrorlist.centos.org/?release=6.10&arch=$basearch&repo=extras&infra=$infra
32baseurl=https://vault.centos.org/6.10/extras/$basearch/
33gpgcheck=1
34gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
35
36#additional packages that extend functionality of existing packages
37[centosplus]
38name=CentOS-6.10 - Plus
39#mirrorlist=http://mirrorlist.centos.org/?release=6.10&arch=$basearch&repo=centosplus&infra=$infra
40baseurl=https://vault.centos.org/6.10/centosplus/$basearch/
41gpgcheck=1
42enabled=0
43gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
44
45#contrib - packages by Centos Users
46[contrib]
47name=CentOS-6.10 - Contrib
48#mirrorlist=http://mirrorlist.centos.org/?release=6.10&arch=$basearch&repo=contrib&infra=$infra
49baseurl=https://vault.centos.org/6.10/contrib/$basearch/
50gpgcheck=1
51enabled=0
52gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  • CentOS-Debuginfo.repo :

fix_centos6_repo/CentOS-Debuginfo.repo
 1# CentOS-Debug.repo
 2#
 3# The mirror system uses the connecting IP address of the client and the
 4# update status of each mirror to pick mirrors that are updated to and
 5# geographically close to the client.  You should use this for CentOS updates
 6# unless you are manually picking other mirrors.
 7#
 8
 9# All debug packages from all the various CentOS-5 releases
10# are merged into a single repo, split by BaseArch
11#
12# Note: packages in the debuginfo repo are currently not signed
13#
14
15[base-debuginfo]
16name=CentOS-6 - Debuginfo
17baseurl=http://debuginfo.centos.org/6/$basearch/
18gpgcheck=1
19gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-6
20enabled=0
  • CentOS-Media.repo :

fix_centos6_repo/CentOS-Media.repo
 1# CentOS-Media.repo
 2#
 3#  This repo can be used with mounted DVD media, verify the mount point for
 4#  CentOS-6.  You can use this repo and yum to install items directly off the
 5#  DVD ISO that we release.
 6#
 7# To use this repo, put in your DVD and use it with the other repos too:
 8#  yum --enablerepo=c6-media [command]
 9#  
10# or for ONLY the media repo, do this:
11#
12#  yum --disablerepo=\* --enablerepo=c6-media [command]
13 
14[c6-media]
15name=CentOS-6.10 - Media
16baseurl=file:///media/CentOS/
17        file:///media/cdrom/
18        file:///media/cdrecorder/
19gpgcheck=1
20enabled=0
21gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  • CentOS-Vault.repo :

fix_centos6_repo/CentOS-Vault.repo
  1# CentOS-Vault.repo
  2#
  3# CentOS Vault holds packages from previous releases within the same CentOS Version
  4# these are packages obsoleted by the current release and should usually not 
  5# be used in production
  6#-----------------
  7
  8[C6.0-base]
  9name=CentOS-6.0 - Base
 10baseurl=http://vault.centos.org/6.0/os/$basearch/
 11gpgcheck=1
 12gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 13enabled=0
 14
 15[C6.0-updates]
 16name=CentOS-6.0 - Updates
 17baseurl=http://vault.centos.org/6.0/updates/$basearch/
 18gpgcheck=1
 19gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 20enabled=0
 21
 22[C6.0-extras]
 23name=CentOS-6.0 - Extras
 24baseurl=http://vault.centos.org/6.0/extras/$basearch/
 25gpgcheck=1
 26gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 27enabled=0
 28
 29[C6.0-contrib]
 30name=CentOS-6.0 - Contrib
 31baseurl=http://vault.centos.org/6.0/contrib/$basearch/
 32gpgcheck=1
 33gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 34enabled=0
 35
 36[C6.0-centosplus]
 37name=CentOS-6.0 - CentOSPlus
 38baseurl=http://vault.centos.org/6.0/centosplus/$basearch/
 39gpgcheck=1
 40gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 41enabled=0
 42#-----------------
 43
 44[C6.1-base]
 45name=CentOS-6.1 - Base
 46baseurl=http://vault.centos.org/6.1/os/$basearch/
 47gpgcheck=1
 48gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 49enabled=0
 50
 51[C6.1-updates]
 52name=CentOS-6.1 - Updates
 53baseurl=http://vault.centos.org/6.1/updates/$basearch/
 54gpgcheck=1
 55gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 56enabled=0
 57
 58[C6.1-extras]
 59name=CentOS-6.1 - Extras
 60baseurl=http://vault.centos.org/6.1/extras/$basearch/
 61gpgcheck=1
 62gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 63enabled=0
 64
 65[C6.1-contrib]
 66name=CentOS-6.1 - Contrib
 67baseurl=http://vault.centos.org/6.1/contrib/$basearch/
 68gpgcheck=1
 69gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 70enabled=0
 71
 72[C6.1-centosplus]
 73name=CentOS-6.1 - CentOSPlus
 74baseurl=http://vault.centos.org/6.1/centosplus/$basearch/
 75gpgcheck=1
 76gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 77enabled=0
 78#-----------------
 79
 80[C6.2-base]
 81name=CentOS-6.2 - Base
 82baseurl=http://vault.centos.org/6.2/os/$basearch/
 83gpgcheck=1
 84gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 85enabled=0
 86
 87[C6.2-updates]
 88name=CentOS-6.2 - Updates
 89baseurl=http://vault.centos.org/6.2/updates/$basearch/
 90gpgcheck=1
 91gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 92enabled=0
 93
 94[C6.2-extras]
 95name=CentOS-6.2 - Extras
 96baseurl=http://vault.centos.org/6.2/extras/$basearch/
 97gpgcheck=1
 98gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 99enabled=0
100
101[C6.2-contrib]
102name=CentOS-6.2 - Contrib
103baseurl=http://vault.centos.org/6.2/contrib/$basearch/
104gpgcheck=1
105gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
106enabled=0
107
108[C6.2-centosplus]
109name=CentOS-6.2 - CentOSPlus
110baseurl=http://vault.centos.org/6.2/centosplus/$basearch/
111gpgcheck=1
112gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
113enabled=0
114#-----------------
115
116[C6.3-base]
117name=CentOS-6.3 - Base
118baseurl=http://vault.centos.org/6.3/os/$basearch/
119gpgcheck=1
120gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
121enabled=0
122
123[C6.3-updates]
124name=CentOS-6.3 - Updates
125baseurl=http://vault.centos.org/6.3/updates/$basearch/
126gpgcheck=1
127gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
128enabled=0
129
130[C6.3-extras]
131name=CentOS-6.3 - Extras
132baseurl=http://vault.centos.org/6.3/extras/$basearch/
133gpgcheck=1
134gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
135enabled=0
136
137[C6.3-contrib]
138name=CentOS-6.3 - Contrib
139baseurl=http://vault.centos.org/6.3/contrib/$basearch/
140gpgcheck=1
141gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
142enabled=0
143
144[C6.3-centosplus]
145name=CentOS-6.3 - CentOSPlus
146baseurl=http://vault.centos.org/6.3/centosplus/$basearch/
147gpgcheck=1
148gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
149enabled=0
150#-----------------
151
152[C6.4-base]
153name=CentOS-6.4 - Base
154baseurl=http://vault.centos.org/6.4/os/$basearch/
155gpgcheck=1
156gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
157enabled=0
158
159[C6.4-updates]
160name=CentOS-6.4 - Updates
161baseurl=http://vault.centos.org/6.4/updates/$basearch/
162gpgcheck=1
163gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
164enabled=0
165
166[C6.4-extras]
167name=CentOS-6.4 - Extras
168baseurl=http://vault.centos.org/6.4/extras/$basearch/
169gpgcheck=1
170gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
171enabled=0
172
173[C6.4-contrib]
174name=CentOS-6.4 - Contrib
175baseurl=http://vault.centos.org/6.4/contrib/$basearch/
176gpgcheck=1
177gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
178enabled=0
179
180[C6.4-centosplus]
181name=CentOS-6.4 - CentOSPlus
182baseurl=http://vault.centos.org/6.4/centosplus/$basearch/
183gpgcheck=1
184gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
185enabled=0
186
187#-----------------
188
189[C6.5-base]
190name=CentOS-6.5 - Base
191baseurl=http://vault.centos.org/6.5/os/$basearch/
192gpgcheck=1
193gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
194enabled=0
195
196[C6.5-updates]
197name=CentOS-6.5 - Updates
198baseurl=http://vault.centos.org/6.5/updates/$basearch/
199gpgcheck=1
200gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
201enabled=0
202
203[C6.5-extras]
204name=CentOS-6.5 - Extras
205baseurl=http://vault.centos.org/6.5/extras/$basearch/
206gpgcheck=1
207gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
208enabled=0
209
210[C6.5-contrib]
211name=CentOS-6.5 - Contrib
212baseurl=http://vault.centos.org/6.5/contrib/$basearch/
213gpgcheck=1
214gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
215enabled=0
216
217[C6.5-centosplus]
218name=CentOS-6.5 - CentOSPlus
219baseurl=http://vault.centos.org/6.5/centosplus/$basearch/
220gpgcheck=1
221gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
222enabled=0
223
224#-----------------
225
226[C6.6-base]
227name=CentOS-6.6 - Base
228baseurl=http://vault.centos.org/6.6/os/$basearch/
229gpgcheck=1
230gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
231enabled=0
232
233[C6.6-updates]
234name=CentOS-6.6 - Updates
235baseurl=http://vault.centos.org/6.6/updates/$basearch/
236gpgcheck=1
237gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
238enabled=0
239
240[C6.6-extras]
241name=CentOS-6.6 - Extras
242baseurl=http://vault.centos.org/6.6/extras/$basearch/
243gpgcheck=1
244gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
245enabled=0
246
247[C6.6-contrib]
248name=CentOS-6.6 - Contrib
249baseurl=http://vault.centos.org/6.6/contrib/$basearch/
250gpgcheck=1
251gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
252enabled=0
253
254[C6.6-centosplus]
255name=CentOS-6.6 - CentOSPlus
256baseurl=http://vault.centos.org/6.6/centosplus/$basearch/
257gpgcheck=1
258gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
259enabled=0
260
261#-----------------
262
263[C6.7-base]
264name=CentOS-6.7 - Base
265baseurl=http://vault.centos.org/6.7/os/$basearch/
266gpgcheck=1
267gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
268enabled=0
269
270[C6.7-updates]
271name=CentOS-6.7 - Updates
272baseurl=http://vault.centos.org/6.7/updates/$basearch/
273gpgcheck=1
274gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
275enabled=0
276
277[C6.7-extras]
278name=CentOS-6.7 - Extras
279baseurl=http://vault.centos.org/6.7/extras/$basearch/
280gpgcheck=1
281gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
282enabled=0
283
284[C6.7-contrib]
285name=CentOS-6.7 - Contrib
286baseurl=http://vault.centos.org/6.7/contrib/$basearch/
287gpgcheck=1
288gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
289enabled=0
290
291[C6.7-centosplus]
292name=CentOS-6.7 - CentOSPlus
293baseurl=http://vault.centos.org/6.7/centosplus/$basearch/
294gpgcheck=1
295gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
296enabled=0
297
298#-----------------
299
300[C6.8-base]
301name=CentOS-6.8 - Base
302baseurl=http://vault.centos.org/6.8/os/$basearch/
303gpgcheck=1
304gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
305enabled=0
306
307[C6.8-updates]
308name=CentOS-6.8 - Updates
309baseurl=http://vault.centos.org/6.8/updates/$basearch/
310gpgcheck=1
311gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
312enabled=0
313
314[C6.8-extras]
315name=CentOS-6.8 - Extras
316baseurl=http://vault.centos.org/6.8/extras/$basearch/
317gpgcheck=1
318gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
319enabled=0
320
321[C6.8-contrib]
322name=CentOS-6.8 - Contrib
323baseurl=http://vault.centos.org/6.8/contrib/$basearch/
324gpgcheck=1
325gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
326enabled=0
327
328[C6.8-centosplus]
329name=CentOS-6.8 - CentOSPlus
330baseurl=http://vault.centos.org/6.8/centosplus/$basearch/
331gpgcheck=1
332gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
333enabled=0
334
335#-----------------
336
337[C6.9-base]
338name=CentOS-6.9 - Base
339baseurl=http://vault.centos.org/6.9/os/$basearch/
340gpgcheck=1
341gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
342enabled=0
343
344[C6.9-updates]
345name=CentOS-6.9 - Updates
346baseurl=http://vault.centos.org/6.9/updates/$basearch/
347gpgcheck=1
348gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
349enabled=0
350
351[C6.9-extras]
352name=CentOS-6.9 - Extras
353baseurl=http://vault.centos.org/6.9/extras/$basearch/
354gpgcheck=1
355gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
356enabled=0
357
358[C6.9-contrib]
359name=CentOS-6.9 - Contrib
360baseurl=http://vault.centos.org/6.9/contrib/$basearch/
361gpgcheck=1
362gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
363enabled=0
364
365[C6.9-centosplus]
366name=CentOS-6.9 - CentOSPlus
367baseurl=http://vault.centos.org/6.9/centosplus/$basearch/
368gpgcheck=1
369gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
370enabled=0
  • CentOS-fasttrack.repo :

fix_centos6_repo/CentOS-fasttrack.repo
1[fasttrack]
2name=CentOS-6 - fasttrack
3#mirrorlist=http://mirrorlist.centos.org/?release=6.10&arch=$basearch&repo=fasttrack&infra=$infra
4baseurl=https://vault.centos.org/6.10/fasttrack/$basearch/
5gpgcheck=1
6enabled=0
7gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  • 然后做一次系统更新:

    yum update
    

EPEL软件仓库修复

EPEL 是基于Fedora完全兼容EPEL/CentOS的软件仓库,提供了更多的扩展软件。不过,随着RHEL/CentOS 6产品生命周期终止,官方已经不再直接提供仓库RHEL/CentOS 6安装包。不过,依然从 EPEL 6归档 中安装

  • 安装EPEL for RHEL/CentOS 6.8:

    rpm -ivh https://archives.fedoraproject.org/pub/archive/epel/6/x86_64/epel-release-6-8.noarch.rpm
    
  • 然后执行更新:

    yum update
    

参考