centos5安装yum源

前端之家收集整理的这篇文章主要介绍了centos5安装yum源前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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


2、

阿里源:

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

网易源:

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


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


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

cd /etc/yum.repos.d

vi 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-$releasever - Base  
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os  
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/  
baseurl=http://vault.centos.org/5.11/os/$basearch/  
gpgcheck=1  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5  


#released updates   
[updates]  
name=CentOS-$releasever - Updates  
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates  
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/  
baseurl=http://vault.centos.org/5.11/updates/$basearch/  
gpgcheck=1  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5  


#additional packages that may be useful  
[extras]  
name=CentOS-$releasever - Extras  
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras  
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/  
baseurl=http://vault.centos.org/5.11/extras/$basearch/  
gpgcheck=1  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5  




#additional packages that extend functionality of existing packages  
[centosplus]  
name=CentOS-$releasever - Plus  
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus  
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/  
baseurl=http://vault.centos.org/5.11/centosplus/$basearch/  
gpgcheck=1  
enabled=0  
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5  




#contrib - packages by Centos Users  
[contrib]  
name=CentOS-$releasever - Contrib  
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib  
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/  
baseurl=http://vault.centos.org/5.11/contrib/$basearch/  
gpgcheck=1  
enabled=0  
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]#

猜你在找的CentOS相关文章