Red Hat Enterprise Linux 6配置CentOS的yum源

                        Red Hat Enterprise Linux 6配置CentOS的yum源

    前言: 由于使用redhat官方yum源需要注册购买server服务,否则就会提示注册,或者根本找不到rehat的源。但是CentOS是redhat的免费版,除了log和一些无关紧要的东西,其他都是一样的。甚至kernel源代码都是一样的。所以我们可以使用CentOS的yum源代替redhat的yum源。

《《《《《 《《《《《《《本文笔者亲测成功》》》》》》》》》》》》》》》》》》》》》》

   前提:防火墙关闭,可能会影响ftp响应

1:卸载自带的与yum:

rpm -aq|grep yum|xargs rpm -e --nodeps

2:下载centos源必须文件:

    自己到:http://mirrors.163.com/centos/6/os/x86_64如果是i386的就到http://mirrors.163.com/centos/6/os/i386下找这些文件:

   python-iniparse-0.3.1-2.1.el6.noarch.rpm
   yum-3.2.29-69.el6.centos.noarch.rpm
   yum-metadata-parser-1.1.2-16.el6.i686.rpm
   yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

    也可以直接:

        wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
        wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-69.el6.centos.noarch.rpm
        wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm
        wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

3:安装这些文件

        rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
        rpm -ivh yum-metadata-parser-1.1.2-16.el6.i686.rpm
        rpm -ivh yum-3.2.29-69.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm    :这里是两个一起安装,否则会有依赖报错
4:cd /etc/yum.repos.d
ls -lh
mv /yum.repos.d/rhel-debuginfo.repo /yum.repos.d/rhel-debuginfo.repo.back
vim /etc/yum.repos.d/CentOS-Base-163.repo

5:修该CentOS-Base-163.repo的内容

vi /etc/yum.repos.d/CentOS-Base-163.repo
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
保存退出之后:
yum update

试一下:yum install gcc(测试是否成功)

6:大功告成

本文出自 “11464235” 博客,谢绝转载!

你可能感兴趣的:(linux,server,源代码)