red hat替换centos yum源

前端之家收集整理的这篇文章主要介绍了red hat替换centos yum源前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.删除redhat原有的yum
rpm -aq|grep yum|xargs rpm -e --nodeps

2.下载yum安装文件

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-[3.2.27-14.el6].centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-Metadata-parser-1.1.2-14.1.el6.x86_64].rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.el6].noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6].noarch.rpm

3.进行安装yum

rpm -ivh --nodepspython-iniparse-[0.3.1-2.1.el6].noarch.rpm
rpm -ivh --nodepsyum-Metadata-parser---nodepsyum-3.2.27-14.el6].centos.noarch.rpm

--nodepsyum-plugin-fastestmirror-].noarch.rpm

#注【】表示变化内容,具体版本根据镜像源内容进行替换

4.更新repo文件

mv /etc/yum.repos.d/rhel-source.repo /etc/yum.repos.d/rhel-source.repo.bak

vi/etc/yum.repos.d/CentOS-Base.repo

内容为:

[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
#packages used/produced in the build but not released
#[addons]
#name=CentOS-$releasever - Addons
#baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
#gpgcheck=1
#gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
enabled=0

5.

yum clean all

yum install vim#测试一下可不可以用

---------------------------------------------------------

安装EPEL源

1.https://fedoraproject.org/wiki/EPEL/zh-cn

图片20160626111259.png" alt="wKioL1dvSHGROP98AAKWm-JHX8c327.png-wh_50" src="http://s1.51cto.com/wyfs02/M00/83/48/wKioL1dvSHGROP98AAKWm-JHX8c327.png-wh_500x0-wm_3-wmp_4-s_679089546.png">


进去之后下载epel-release-6-8.noarch


wKiom1dvSLnhAw3eAAA7xSiWNCU740.png-wh_50

2.安装epel

rpm -ivh epel-release-6-8.noarch.rpm


3.执行 yum clean all 清理yum缓存


4. 执行 yum repolist


wKioL1dvTRyyTToNAAA3OwMFyVc285.png-wh_50


上面可以看到EPEL源已经成功添加到源列表中去了,并且显示已经提供了上万个软件包!

114304yzawau6qu4jqwsaa.jpg


如果出现这样的错误

Error: Cannot retrieve Metalink for repository: epel. Please verify its path and try again

编辑:vi /etc/yum.repos.d/epel.repo 将baseurl启用,mirrorlist注释


如下:

baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch

#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch


再执行 yum repolist

……OK!……

原文链接:https://www.f2er.com/centos/381833.html

猜你在找的CentOS相关文章