根据需要选择设置源:
一、如何设置CentOS 5的yum源为上海交通大学网站
二、设置yum源为国内的服务器
三、CentOS 下使用本地镜像源
一。如何设置CentOS 5的yum源为上海交通大学网站
1.修改/etc/yum.repos.d/CentOS-Base.repo为:
CentOS-Base.repo
[base]
name=CentOS-5 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&
repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://ftp.sjtu.edu.cn/centos/5.0/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#released updates
[update]
name=CentOS-5 - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/5.0/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#packages used/produced in the build but not released
[addons]
name=CentOS-5 - Addons
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons
baseurl=http://ftp.sjtu.edu.cn/centos/5.0/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#additional packages that may be useful
[extras]
name=CentOS-5 - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras
baseurl=http://ftp.sjtu.edu.cn/centos/5.0/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus
baseurl=http://ftp.sjtu.edu.cn/centos/5.0/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib
baseurl=http://ftp.sjtu.edu.cn/centos/5.0/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
2.执行
64位:
rpm --import [url]http://ftp.sjtu.edu.cn/centos/5.0/os/x86_64/RPM-GPG-KEY-CentOS-5[/url]
32位:
rpm --import [url]http://ftp.sjtu.edu.cn/centos/5.0/os/i386/RPM-GPG-KEY-CentOS-5[/url]
3.执行
yum update
Ok了,搞定。
二、设置yum源为国内的服务器:
1.相关需更改配置文件位置同上。
# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# 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-5 - Base
baseurl=http://mirror.be10.com/centos/5/os/i386/
gpgcheck=1
#released updates
[update]
name=CentOS-5 - Updates
baseurl=http://mirror.be10.com/centos/5/updates/i386/
gpgcheck=1
#packages used/produced in the build but not released
[addons]
name=CentOS-5 - Addons
baseurl=http://mirror.be10.com/centos/5/addons/i386/
gpgcheck=1
#additional packages that may be useful
[extras]
name=CentOS-5 - Extras
baseurl=http://mirror.be10.com/centos/5/extras/i386/
gpgcheck=1
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
baseurl=http://mirror.be10.com/centos/5/centosplus/i386/
gpgcheck=1
enabled=0
#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib
baseurl=http://mirror.be10.com/centos/5/contrib/i386/
gpgcheck=1
enabled=0
#packages in testing
[testing]
name=CentOS-5 - Testing
baseurl=http://mirror.be10.com/centos/5/testing/i386/
gpgcheck=1
enabled=0
2.rpm --import [url]http://mirror.be10.com/centos/RPM-GPG-KEY-CentOS-5[/url]
三、CentOS 下使用本地镜像源
不知道大家有没有和我一样尝试使用rsync 同步mirrors.kernel.org/CentOS,总计超过6G的数据在只有30-50KB/s的速度下传输,也许需要3-5天才可以完成。怎么办?使用国内的服务器吧,但是他们只提供yum源更新,也就是只能使用http访问,而不提供rsync server。
这是我找到的一个速度不错的CentOS 4/5 yum源:218.201.144.68
使用wget将centos 5镜像到本地磁盘上
mkdir -pv /opt/CentOS
cd /opt/CentOS
wget -m -c [url]http://218.201.144.68/centos/5/os/i386/[/url]
以上命令会从网络上抓取2.6G左右的数据,会运行很长时间,你完全可以去做其它的工作。完成后,使用ls命令看看我们获取到的数据,我们只需要保留i386目录下面的数据,将其移动到opt,并将下载时产生的index.html?之类文件一并删除
cd /opt/CentOS/218.201.144.68/centos/5/os/
mv i386 /opt/CentOS5
cd /opt
rm -rf CentOS
find CentOS5 -name index.htm?\* -exec rm -f{}\;
下一步配置yum更新源。CentOS已经在/etc/yum.repos.d下面创建了CentOS-Media.repo,对该文件做适应修改就可以使用。以下是修改结果
[root@localhost etc]# cat yum.repos.d/CentOS-Media.repo
# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
# CentOS-5. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c4-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c4-media [command]
[c5-media]
name=CentOS-$releasever - Media
baseurl=file:///opt/CentOS
# file:///media/cdrom/
# file:///media/cdrecorder/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-beta
现在就可以使用yum check-update来测验一下本地源了。如果在没有连接网络情况,最好把yum.repos.d目录下面的其它repo文件适当更名,这样yum就只使用本地源,速度得以提升。

更改centos 5 yum源相关推荐

  1. redhat配置centos的yum源

    redhat默认不支持第三方的yum源,要求有rhn账号,下面就rhel5和rhel6改为centos源 一.rhel5.5 X86_64更改为centos的yum源 查看系统自带的yum相关的rpm ...

  2. Redhat 7 yum源换成centos的YUM 源

    背景:作者打算在Redhat 做kvm虚拟化的时候在安装 virt-manager发现 提示要注册红帽的yum源,简单说要钱呗.要钱那是不可能给你的,所以有以下有centos的yum源替换redhat ...

  3. 将Centos的yum源更换为阿里云源

    将Centos的yum源更换为阿里云源 1.备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.back ...

  4. php71+yum源+epel,搭建CentOS在线yum源镜像服务器

    说明: 操作系统:CentOS 6.7 Nginx版本:1.8.0 rsync版本:3.0.6 IP地址和端口:192.168.3.100:8080 目标:同步CentOS镜像站点的内容到此服务器,通 ...

  5. rhel5.3服务器安装centOS的yum源

    在网上看到好多的关于这个方面的帖子,最近上了台rhel5.3的服务器,苦于安装时候缺少了gd库,又不想跑机房,就倒弄,给它装上centos的yum源! 把自己安装过程写下来,网上有的写得不够详细,自己 ...

  6. CentOS系统yum源使用报错:Error: Cannot retrieve repository metadata

    服务器上的yum突然不好使用,使用yum的时候报错如下: [root@bastion-IDC src]# yum list ...... Could not retrieve mirrorlist h ...

  7. RedHat Linux 7安装CentOS 7 yum源

    RedHat Linux 7安装CentOS 7 yum源 问题描述 解决步骤 0,进入/opt目录,进入root模式,新建yum目录 1,查看自己redhat版本 2,查看redhat 7.0系统本 ...

  8. 更新linux yum源,CentOS 更新yum源

    CentOS更新yum源(中科大) yum安装方式在有网络环境的时候非常方便,选择一个比较快的yum源是非常有意义的 源文件下载地址: 1.更名当前的repo文件 mv /etc/yum.repos. ...

  9. Centos 本地yum源配置以及扩展源

    Centos 本地yum源配置以及扩展源 提示:有任何问题可以私信我,下班看到第一时间回复 yum本地源 Centos 本地yum源配置以及扩展源 一.将光盘挂载到/mnt下面 二.删除系统本身自带的 ...

最新文章

  1. java map一对多映射_java – Mapstruct:将多个源对象映射到子对象
  2. 人形图案c语言程序_做游戏,学编程(C语言) 7 学习EasyX图形交互功能----flappy bird源代码...
  3. 后台工具screen
  4. 【干货】马化腾亲身分享:腾讯兵法教你做一款高口碑的产品
  5. python环境变量配置_21 python环境的配置
  6. CF25E-Test【AC自动机,bfs】
  7. tomcatSupplement(1)tomcat启动脚本分析(以Windows平台为例)
  8. 批量从网上下载图片、zip等文件到本地[java爬虫]
  9. 让Python输出更漂亮
  10. RTOS原理与实现07:邮箱实现
  11. eclipse-阶段三-Server被关闭后消失,如何打开
  12. xml 操作组件(NewLife.XCode)
  13. ubuntu 14.04 安装中文输入法fcitx
  14. IDEA插件修改class文件
  15. PCL包围盒(详细介绍)
  16. 奇安信天擎的退出以及卸载
  17. 盘式过滤器详细介绍分析
  18. 基于量子计算的无收益标的资产欧式看涨期权定价和delta风险分析
  19. RocketMQ可视化Web管理界面
  20. 超级任天堂模拟器 bsnes 开发者自杀(文末附模拟器及ROM)

热门文章

  1. html5-article元素
  2. 【Linux】Shell三类变量的作用域——linux shell “永久环境变量”、“临时环境变量”和普通变量之完全解读...
  3. Android LayoutInflater原理分析,带你一步步深入了解View(一)
  4. 【教程】Matrikon OPC使用教程连载(四)
  5. 区块链的价值在于建立信任,而ICO却在摧毁信任
  6. nyoj 925 国王的烦恼(最小生成树)
  7. 图片(img标签)的onerror事件
  8. 【转】adobe acrobat pro修改pdf文字
  9. Day10_linux计划任务管理
  10. uva 11069 A Graph Problem