首页 > 代码库 > RedHat 6.4使用CentOS源和epel源

RedHat 6.4使用CentOS源和epel源

  说明:之前一直使用CentOS的系统,现在由于工作中有的使用的是RedHat的系统。因此有必要学习下RedHat中怎么使用CentOS源和epel源。

  Red Hat Enterprise Linux Server(RHEL) yum服务是付费的,因为没有付费,所以无法使用yum安装软件。通过删除自带的yum,安装上centosyum,并且使用centosyum源和epel源之后,可以像使用centos一样的使用免费yum源。

 

具体操作如下

  • 删除yum

#rpm -qa|grep yum|xargs rpm-e –nodeps


  • 下载centos版的yum文件

查看系统的版本:

#cat /etc/redhat-release


Red Hat EnterpriseLinux Server release 6.4 (Santiago)

将下面4rpm包去centos上的源下载对应版本

python-iniparse-0.3.1-2.1.el6.noarch.rpm 

yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

yum-3.2.29-40.el6.centos.noarch.rpm      

yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

  • 安装yum文件

#rpm –ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
#rpm –ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
#rpm –ivh yum-3.2.29-40.el6.centos.noarch.rpmyum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm


备注:最后2个有依赖关系,需一同安装

  • 下载centos的源

我这里直接使用163的源,

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


下载之后将其放到/etc/yum.repos.d目录下

#mv CentOS6-Base-163.repo/etc/yum.repos.d/CentOS-Base.repo


将其中的$releasever替换成对应的版本,这里为6

#sed  -i‘s/$releasever/6/g‘ CentOS-Base.repo


五、清除缓存并安装epel

#yum clean all


将之前的缓存删除

安装epel

#yum install epel-release


Red Hat默认情况下,直接使用epel源会报错

Error:Cannot retrieve metalink for repository: epel. Please verify its path and tryagain

解决方法:

#vim /etc/yum.repos.d/epel.repo


#baseurl
mirrorlist

改成

baseurl
#mirrorlist

修改完之后就可以使用epel源了。

下面是演示效果

#yum makecache
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to r
egister.Loading mirror speeds from cached hostfile
base                                                                            | 3.7 kB     00:00     
base/group_gz                                                                   | 226 kB     00:00     
base/other_db                                                                   | 2.8 MB     00:08     
epel                                                                            | 4.3 kB     00:00     
epel/group_gz                                                                   | 150 kB     00:00     
epel/filelists_db                                                               | 7.7 MB     00:08     
epel/updateinfo                                                                 | 730 kB     00:01     
epel/other_db                                                                   | 2.9 MB     00:03     
extras                                                                          | 3.4 kB     00:00     
extras/prestodelta                                                              | 1.3 kB     00:00     
extras/other_db                                                                 |  51 kB     00:00     
local                                                                           | 2.9 kB     00:00     
local/other_db                                                                  | 2.8 MB     00:00     
updates                                                                         | 3.4 kB     00:00     
updates/prestodelta                                                             | 269 kB     00:00     
updates/other_db                                                                |  49 MB     01:58     
Metadata Cache Created


本文出自 “梦想人生” 博客,请务必保留此出处http://hzde0128.blog.51cto.com/918211/1876511

RedHat 6.4使用CentOS源和epel源