Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8378
  • 博文数量: 4
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 5
  • 用 户 组: 普通用户
  • 注册时间: 2014-01-18 17:04
个人简介

老骥伏枥,志在千里! 烈士暮年,壮心不已!

文章分类

全部博文(4)

文章存档

2015年(4)

我的朋友

分类: LINUX

2015-12-28 23:13:06

redhat 默认自带的 yum 源需要注册,才能更新。我们想不花钱也可以更新,需要替换掉redhat的yum
源,具体的实现方式如下: 


1、检查是否安装yum包 


查看RHEL是否安装了yum,若是安装了,那么又有哪些yum包: 


[root@localhost ~]# rpm -qa |grep yum 


yum-metadata-parser-1.0-8.fc6 


yum-3.0.1-5.el5 


yum-rhn-plugin-0.4.3-1.el5 


yum-updatesd-3.0.1-5.el5 


2、删除redhat自带的yum包 


卸载上面显示的所有yum包: 


[root@localhost ~]# rpm -qa|grep yum|xargs rpm -e --nodeps(不检查依赖,直接删除rpm包) 


再用 


[root@localhost ~]# rpm -qa |grep yum 


[root@localhost ~]# 


查看,无信息显示表示已经卸载完成。 


3、下载新的yum包。使用Centos6.5的yum包 


# wget


# wget


# wget


最新的下载包2015年12月10日


替换6.6 为6.7






 


4、安装yum软件包 


注意:单个的安装包可能会依赖其它包(例如yum和yum-fastestmirror会相互依赖),所以我们可以把所有
这些包放在一起,用一行命令将它们同时安装即可: 


rpm –ivh yum-metadata-parser-1.1.2-16.el6.i686.rpm yum-3.2.29-60.el6.centos.noarch.rpm 
yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm 


 


5、更新yum源 


在/etc/yum.repos.d/目录下去除原有的*.repo文件,新建一个新的Base.repo文件,该文件的内容如下: 


(注意,文件中相应的baseurl需要确保路径正确,所以有必要检查实际的ftp镜像路劲是否存在) 


# 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-6.5 - Base - 163.com 



baseurl=


#mirrorlist=


gpgcheck=1 


gpgkey=


 


#released updates 


[updates] 


name=CentOS-6.5 - Updates - 163.com 


baseurl=


#mirrorlist=


gpgcheck=1 


gpgkey=


 


#additional packages that may be useful 
[extras] 
name=CentOS-6.5 - Extras - 163.com 


baseurl=


#mirrorlist=


gpgcheck=1 


gpgkey=


 


#additional packages that extend functionality of existing packages 


[centosplus] 


name=CentOS-6.5 - Plus - 163.com 


baseurl=


#mirrorlist=


gpgcheck=1 


enabled=0 


gpgkey=


 


#contrib - packages by Centos Users 


[contrib] 


name=CentOS-6.5 - Contrib - 163.com 


baseurl=


#mirrorlist=


gpgcheck=1 


enabled=0 


gpgkey=


 


6、清除原有缓存 


yum clean all 


7、重建缓存,以提高搜索安装软件的速度 


yum makecache 


8、更新系统 


yum update 


 


至此就完成对yum源的配置,接下来就可使用yum 进行软件升级与安装。 

阅读(992) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~