温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

RHEL如何配置Centos yum源

发布时间:2021-07-19 14:23:55 来源:亿速云 阅读:115 作者:小新 栏目:系统运维

小编给大家分享一下RHEL如何配置Centos yum源,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

由于RHEL的yum在线更新是收费的,如果没有注册的话是不能使用的,即不能在线安装软件。在这种情况下,如果我们使用的机器安装的是RHEL系统要是每次安装软件先挂载本地光盘会很繁琐,而且有些软件也是老版本的,这种情况下我们可以借助CentOS的YUM源来满足我们的需求。

一、删除RHEL原有的YUM

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

二、下载CentOS的yum安装包(163源)

wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm

wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm

wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpm  

wget http://mirrors.163.com/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5

三、安装CentOS的YUM安装包

yum和yum-plugin-fastestmirror需要一起安装,这两个包存在依赖关系,分开安装会失败,安装之前先把RPM-GPG-KEY导入系统,否则会出现警告信息

rpm -ivh yum-metadata-parser-1.1.2-4.el5.x86_64.rpm  

rpm --import RPM-GPG-KEY-CentOS-5

rpm –ivh yum-3.2.22-40.el5.centos.noarch.rpm  yum-fastestmirror-1.1.16-21.el5.centos.noarch.rm

至此我们就可以在线使用yum了

四、修改yum源

为了使用在线使用Yum安装软件更快,我们可以使用国内的网易Yum源或者其他国内yum源

五、更改yum源 

#我们使用网易的CentOS镜像源

cd /etc/yum.repos.d/

vi rhel-debuginfo.repo

# CentOS-Base.repo

#

# The mirror system uses the connecting IP address of the client and the

# update status of each mirror to pick mirrors that are updated to and

# geographically close to the client.  You should use this for CentOS updates

# unless you are manually picking other mirrors.

#

# If the mirrorlist= does not work for you, as a fall back you can try the

# remarked out baseurl= line instead.

#

#

[base]

name=CentOS-5 - Base - 163.com

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

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

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#released updates

[updates]

name=CentOS-5 - Updates - 163.com

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

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

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released

[addons]

name=CentOS-5 - Addons - 163.com

mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=addons

baseurl=http://mirrors.163.com/centos/5/addons/$basearch/

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful

[extras]

name=CentOS-5 - Extras - 163.com

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

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

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-5 - Plus - 163.com

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

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

gpgcheck=1

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users

[contrib]

name=CentOS-5 - Contrib - 163.com

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

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

gpgcheck=1

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

六、清理

yum clean all

yum makecache

七、更新

yum update

以上是“RHEL如何配置Centos yum源”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI