1、遇到问题
在RedHat系统中,默认的yum源需要注册到RedHat Subscription Management才能更新。为了避免花费,我们需要替换为国内的yum源。
2、解决办法
由于CentOS和RedHat系统非常相似,替换为CentOS的yum源是可行的,但过程中可能遇到一些挑战。以下是解决方案的详细步骤,参考了博文:https://www.php.cn/link/95d8f6ff68222377d570a652eb96f082。
(1)删除RedHat自带的yum包
[root@node1 ~]# rpm -qa|grep yum|xargs rpm -e --nodepswarning: /etc/yum/pluginconf.d/langpacks.conf saved as /etc/yum/pluginconf.d/langpacks.conf.rpmsave[root@node1 ~]# rpm -qa |grep yum[root@node1 ~]#
[root@node1 ~]# rpm -qa|grep python-urlgrabber|xargs rpm -e --nodeps
(2)下载yum软件包

从阿里镜像中查找所需的yum包:
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpmwget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpm wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-42.el7.noarch.rpmwget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpmwget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-langpacks-0.4.2-7.el7.noarch.rpmwget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-rhn-plugin-2.0.1-9.el7.noarch.rpmwget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/rpm-4.11.3-25.el7.x86_64.rpm
(3)安装依赖
[root@node1 ~]# rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpmwarning: python-urlgrabber-3.10-8.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEYPreparing... ################################# [100%]Updating / installing... 1:python-urlgrabber-3.10-8.el7 ################################# [100%][root@node1 ~]#
[root@node1 ~]# rpm -Uvh rpm-4.11.3-25.el7.x86_64.rpm --nodepswarning: rpm-4.11.3-25.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEYPreparing... ################################# [100%]Updating / installing... 1:rpm-4.11.3-25.el7 ################################# [ 50%]Cleaning up / removing... 2:rpm-4.11.3-21.el7 ################################# [100%][root@node1 ~]#
(4)安装yum包
[root@node1 ~]# rpm -ivh yum-*warning: yum-3.4.3-154.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEYPreparing... ################################# [100%]Updating / installing... 1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 17%] 2:yum-plugin-fastestmirror-1.1.31-4################################# [ 33%] 3:yum-3.4.3-154.el7.centos ################################# [ 50%] 4:yum-langpacks-0.4.2-7.el7 ################################# [ 67%] 5:yum-rhn-plugin-2.0.1-9.el7 ################################# [ 83%] 6:yum-utils-1.1.31-42.el7 ################################# [100%][root@node1 ~]#
3、更新源
完成上述步骤后,可以使用CentOS的yum源进行更新。
[root@node1 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
更新缓存时可能遇到错误:
[root@node1 ~]# yum makecacheLoaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription- : managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.http://mirrors.aliyun.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not FoundTrying other mirror.To address this issue please refer to the below knowledge base article https://access.redhat.com/articles/1320623If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; No route to host"Trying other mirror.http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; No route to host"Trying other mirror.http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; No route to host"Trying other mirror.http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; No route to host"Trying other mirror.http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; No route to host"Trying other mirror.http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; No route to host"Trying other mirror.http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; No route to host"Trying other mirror.
尝试将CentOS-Base.repo内容更改为163的源:
#CentOS-Base.repoThe 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-$7 - Base - 163.com
mirrorlist=https://www.php.cn/link/588fad4e41a1544c03e7d5625c37cbf0
baseurl=https://www.php.cn/link/8f5f383cc40b32666bf48521713980f4gpgcheck=1gpgkey=https://www.php.cn/link/aa799ad70bea3029d4141c7b773c1a46
released updates
[updates]name=CentOS-$7 - Updates - 163.com
mirrorlist=https://www.php.cn/link/1a795f72604e4e1d35075019929d5b95
baseurl=https://www.php.cn/link/e8d2fc41fb98705874a309ed648806a0gpgcheck=1gpgkey=https://www.php.cn/link/aa799ad70bea3029d4141c7b773c1a46
additional packages that may be useful
[extras]name=CentOS-$7 - Extras - 163.com
mirrorlist=https://www.php.cn/link/edb636f69bf78b885117a47ec1a455d4
baseurl=https://www.php.cn/link/bf6423635e56a99e9df17852c6bfadcagpgcheck=1gpgkey=https://www.php.cn/link/aa799ad70bea3029d4141c7b773c1a46
additional packages that extend functionality of existing packages
[centosplus]name=CentOS-$7 - Plus - 163.combaseurl=https://www.php.cn/link/ea14b04d59d604daf500d9a35bdd01begpgcheck=1enabled=0gpgkey=https://www.php.cn/link/aa799ad70bea3029d4141c7b773c1a46
[root@node1 yum.repos.d]# vi CentOS-Base.repo[root@node1 yum.repos.d]# yum makecacheLoaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/12): base/x86_64/group_gz | 156 kB 00:00:05
(2/12): base/x86_64/filelists_db | 6.7 MB 00:00:06
(3/12): base/x86_64/other_db | 2.5 MB 00:00:00
(4/12): base/x86_64/primary_db | 5.7 MB 00:00:03
(5/12): extras/x86_64/prestodelta | 129 kB 00:00:05
(6/12): extras/x86_64/primary_db | 185 kB 00:00:00
(7/12): extras/x86_64/other_db | 121 kB 00:00:00
(8/12): extras/x86_64/filelists_db | 709 kB 00:00:10
(9/12): updates/x86_64/filelists_db | 4.2 MB 00:00:06
(10/12): updates/x86_64/prestodelta | 960 kB 00:00:06
(11/12): updates/x86_64/primary_db | 6.9 MB 00:00:01
(12/12): updates/x86_64/other_db | 734 kB 00:00:01
Determining fastest mirrorsMetadata Cache Created[root@node1 yum.repos.d]#
以上就是Redhad 7改用CentOS7 yum源【亲测】的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/30384.html
微信扫一扫
支付宝扫一扫