centos5安装yum源

原文  https://blog.csdn.net/kadwf123/article/details/78619821

1、目前国内网易、阿里源已经不可用了。

 

2、

阿里源:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

网易源:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS5-Base-163.repo

 

3、可以执行上面命令,下载下来,不过已经无法使用了。

 

4、可以把内容修改为国外的源:

cd /etc/yum.repos.d

vi CentOS-Base.repo

替换成下列内容:

 
  1. # The mirror system uses the connecting IP address of the client and the

  2. # update status of each mirror to pick mirrors that are updated to and

  3. # geographically close to the client. You should use this for CentOS updates

  4. # unless you are manually picking other mirrors.

  5. #

  6. # If the mirrorlist= does not work for you, as a fall back you can try the

  7. # remarked out baseurl= line instead.

  8. #

  9. #

  10.  
  11.  
  12. [base]

  13. name=CentOS-$releasever - Base

  14. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

  15. #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

  16. baseurl=http://vault.centos.org/5.11/os/$basearch/

  17. gpgcheck=1

  18. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

  19.  
  20.  
  21. #released updates

  22. [updates]

  23. name=CentOS-$releasever - Updates

  24. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

  25. #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/

  26. baseurl=http://vault.centos.org/5.11/updates/$basearch/

  27. gpgcheck=1

  28. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

  29.  
  30.  
  31. #additional packages that may be useful

  32. [extras]

  33. name=CentOS-$releasever - Extras

  34. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

  35. #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/

  36. baseurl=http://vault.centos.org/5.11/extras/$basearch/

  37. gpgcheck=1

  38. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

  39.  
  40.  
  41.  
  42.  
  43. #additional packages that extend functionality of existing packages

  44. [centosplus]

  45. name=CentOS-$releasever - Plus

  46. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

  47. #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/

  48. baseurl=http://vault.centos.org/5.11/centosplus/$basearch/

  49. gpgcheck=1

  50. enabled=0

  51. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

  52.  
  53.  
  54.  
  55.  
  56. #contrib - packages by Centos Users

  57. [contrib]

  58. name=CentOS-$releasever - Contrib

  59. #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib

  60. #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/

  61. baseurl=http://vault.centos.org/5.11/contrib/$basearch/

  62. gpgcheck=1

  63. enabled=0

  64. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5</span></strong></span>

 

 

5、然后清除yum缓存:

[root@mycentos yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, security
Cleaning up Everything
Cleaning up list of fastest mirrors

 

6、重新加载新缓存:

yum makecache 

[root@mycentos yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, security
Determining fastest mirrors
base                                                     | 1.1 kB     00:00     
base/filelists                                           | 3.7 MB     00:38     
base/other                                               |  14 MB     01:47     
base/group                                               | 1.1 MB     00:06     
base/primary                                             | 1.3 MB     00:01     
extras                                                   | 2.1 kB     00:00     
extras/filelists_db                                      | 224 kB     00:00     
extras/other_db                                          | 442 kB     00:00     
extras/group                                             | 9.7 kB     00:00     
extras/primary_db                                        | 173 kB     00:01     
updates                                                  | 1.9 kB     00:00     
updates/filelists_db                                     | 5.2 MB     00:08     
updates/other_db                                         |  30 MB     00:13     
updates/primary_db                                       | 1.0 MB     00:02     
base                                                                  3667/3667
base                                                                  3667/3667
base                                                                  3667/3667
Metadata Cache Created
[root@mycentos yum.repos.d]# yum -y install gcc
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.1.2-55.el5 set to be updated
--> Processing Dependency: cpp = 4.1.2-55.el5 for package: gcc
--> Processing Dependency: libgcc >= 4.1.2-55.el5 for package: gcc
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc
--> Running transaction check
---> Package cpp.x86_64 0:4.1.2-55.el5 set to be updated
---> Package glibc-devel.x86_64 0:2.5-123.el5_11.3 set to be updated
--> Processing Dependency: glibc = 2.5-123.el5_11.3 for package: glibc-devel
--> Processing Dependency: glibc-headers = 2.5-123.el5_11.3 for package: glibc-devel
--> Processing Dependency: glibc-headers for package: glibc-devel
---> Package libgcc.i386 0:4.1.2-55.el5 set to be updated
---> Package libgcc.x86_64 0:4.1.2-55.el5 set to be updated
--> Running transaction check
--> Processing Dependency: glibc = 2.5-81 for package: nscd
---> Package glibc.i686 0:2.5-123.el5_11.3 set to be updated
--> Processing Dependency: glibc-common = 2.5-123.el5_11.3 for package: glibc
---> Package glibc.x86_64 0:2.5-123.el5_11.3 set to be updated
---> Package glibc-headers.x86_64 0:2.5-123.el5_11.3 set to be updated
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers
--> Processing Dependency: kernel-headers for package: glibc-headers
--> Running transaction check
---> Package glibc-common.x86_64 0:2.5-123.el5_11.3 set to be updated
---> Package kernel-headers.x86_64 0:2.6.18-419.el5 set to be updated
---> Package nscd.x86_64 0:2.5-123.el5_11.3 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package              Arch         Version                  Repository     Size
================================================================================
Installing:
 gcc                  x86_64       4.1.2-55.el5             base          5.3 M
Installing for dependencies:
 glibc-devel          x86_64       2.5-123.el5_11.3         updates       2.4 M
 glibc-headers        x86_64       2.5-123.el5_11.3         updates       602 k
 kernel-headers       x86_64       2.6.18-419.el5           updates       1.5 M
Updating for dependencies:
 cpp                  x86_64       4.1.2-55.el5             base          2.9 M
 glibc                i686         2.5-123.el5_11.3         updates       5.4 M
 glibc                x86_64       2.5-123.el5_11.3         updates       4.8 M
 glibc-common         x86_64       2.5-123.el5_11.3         updates        17 M
 libgcc               i386         4.1.2-55.el5             base           97 k
 libgcc               x86_64       4.1.2-55.el5             base          100 k
 nscd                 x86_64       2.5-123.el5_11.3         updates       178 k

Transaction Summary
================================================================================
Install       4 Package(s)
Upgrade       7 Package(s)

Total download size: 40 M
Downloading Packages:
(1/11): libgcc-4.1.2-55.el5.i386.rpm                     |  97 kB     00:00     
(2/11): libgcc-4.1.2-55.el5.x86_64.rpm                   | 100 kB     00:00     
(3/11): nscd-2.5-123.el5_11.3.x86_64.rpm                 | 178 kB     00:01     
(4/11): glibc-headers-2.5-123.el5_11.3.x86_64.rpm        | 602 kB     00:01     
(5/11): kernel-headers-2.6.18-419.el5.x86_64.rpm         | 1.5 MB     00:03     
(6/11): glibc-devel-2.5-123.el5_11.3.x86_64.rpm          | 2.4 MB     00:04     
(7/11): cpp-4.1.2-55.el5.x86_64.rpm                      | 2.9 MB     00:05     
(8/11): glibc-2.5-123.el5_11.3.x86_64.rpm                | 4.8 MB     00:06     
(9/11): gcc-4.1.2-55.el5.x86_64.rpm                      | 5.3 MB     00:05     
(10/11): glibc-2.5-123.el5_11.3.i686.rpm                 | 5.4 MB     00:05     
(11/11): glibc-common-2.5-123.el5_11.3.x86_64.rpm        |  17 MB     00:08     
--------------------------------------------------------------------------------
Total                                           833 kB/s |  40 MB     00:48     
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
base/gpgkey                                              | 1.5 kB     00:00     
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) <centos-5-key@centos.org>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : libgcc                                                  1/18 
  Updating       : glibc-common                                            2/18 
  Updating       : glibc                                                   3/18 
  Updating       : cpp                                                     4/18 
  Updating       : nscd                                                    5/18 
  Updating       : glibc                                                   6/18 
  Updating       : libgcc                                                  7/18 
  Installing     : kernel-headers                                          8/18 
  Installing     : glibc-headers                                           9/18 
  Installing     : glibc-devel                                            10/18 
  Installing     : gcc                                                    11/18 
  Cleanup        : nscd                                                   12/18 
  Cleanup        : glibc                                                  13/18 
  Cleanup        : glibc                                                  14/18 
  Cleanup        : glibc-common                                           15/18 
  Cleanup        : libgcc                                                 16/18 
  Cleanup        : libgcc                                                 17/18 
  Cleanup        : cpp                                                    18/18 

Installed:
  gcc.x86_64 0:4.1.2-55.el5                                                     

Dependency Installed:
  glibc-devel.x86_64 0:2.5-123.el5_11.3                                         
  glibc-headers.x86_64 0:2.5-123.el5_11.3                                       
  kernel-headers.x86_64 0:2.6.18-419.el5                                        

Dependency Updated:
  cpp.x86_64 0:4.1.2-55.el5           glibc.i686 0:2.5-123.el5_11.3             
  glibc.x86_64 0:2.5-123.el5_11.3     glibc-common.x86_64 0:2.5-123.el5_11.3    
  libgcc.i386 0:4.1.2-55.el5          libgcc.x86_64 0:4.1.2-55.el5              
  nscd.x86_64 0:2.5-123.el5_11.3     

Complete!
[root@mycentos yum.repos.d]# 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值