Redhat 6.2 Linux修改yum源免费使用CentOS源

来源:互联网 发布:linux移动文件夹 编辑:程序博客网 时间:2024/06/08 02:32

      在没有光盘的情况,需要安装软件包,就要用到共网的yum源来安装了。

 

      Redhat linux 默认是安装了yum软件的,但是由于激活认证的原因让redhat无法直接进行yum安装一些软件,如果我们需要在redhat下直接yum安装软件,我们只用把yum的源修改成centos的就好了,然后把源里面的变量全部修改成实际的值,这样就能使用yum直接安装我们需要的软件了。

 

使用说明

1、到http://mirrors.163.com的 centos帮助文档 中下载CentOS6-Base-163.repo文件,存放到/etc/yum.repo.d中

Centos 5     wget  http://mirrors.163.com/.help/CentOS5-Base-163.repo

Centos 6     wget  http://mirrors.163.com/.help/CentOS6-Base-163.repo

操作如下:

650) this.width=650;" title="QQ截图20130714231621.png" src="http://img1.51cto.com/attachment/201307/235743835.png" />

2、首先备份/etc/yum.repos.d/CentOS-Base.repo

650) this.width=650;" title="QQ截图20130714224236.png" src="http://img1.51cto.com/attachment/201307/000041359.png" />

 

3、编辑CentOS6-Base-163.repo文件,将其中的$releasever更改为centos的版本号,如果是RedHat 6.2 X86_64为例“baseurl=http://mirrors.163.com/centos/6.2/os/x86_64/”,本文档是以RedHat 6.2 32位为例所写!

 

[base]

name=CentOS-6.2 - Base - 163.com

baseurl=http://mirrors.163.com/centos/6.2/os/$basearch/

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

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6.2

#released updates 

[updates]

name=CentOS-6.2 - Updates - 163.com

baseurl=http://mirrors.163.com/centos/6.2/updates/$basearch/

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

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6.2

#additional packages that may be useful

[extras]

name=CentOS-6.2 - Extras - 163.com

baseurl=http://mirrors.163.com/centos/6.2/extras/$basearch/

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

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6.2

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-6 .2- Plus - 163.com

baseurl=http://mirrors.163.com/centos/6.2/centosplus/$basearch/

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

gpgcheck=1

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6.2

#contrib - packages by Centos Users

[contrib]

name=CentOS-6.2 - Contrib - 163.com

baseurl=http://mirrors.163.com/centos/6.2/contrib/$basearch/

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

gpgcheck=1

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6.2

编辑完后保存,运行:

yum clean all              清除原有缓存 

yum makecache        获取yum列表

 

 

 

  • 本稿件为独家原创稿件,版权所有,引用或转载请注明出处。
  • 文章出处:职场资讯
原创粉丝点击