歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux教程

RedHat 6.2 Linux修改yum源免費使用CentOS源

在沒有光盤的情況,需要安裝軟件包,就要用到共網的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

操作如下:

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

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列表

Copyright © Linux教程網 All Rights Reserved