yum管理-使用yum命令报403 Forbidden错误的解决方法

今天笔者在公司redhat 6.x/7.x服务器上使用yum命令报如下错误:

[root@qq_5201351 ~]# yum list
Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security, subscription-manager
https://cdn.redhat.com/content/dist/rhel/server/6/6Server/x86_64/os/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 403 Forbidden"
Trying other mirror.
To address this issue please refer to the below knowledge base article

https://access.redhat.com/solutions/69319

If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.

Error: Cannot retrieve repository metadata (repomd.xml) for repository: rhel-6-server-rpms. Please verify its path and try again

为了排错,笔者只留下了一个redhat.repo(这个文件移动走了,默认也会自动生成),还是报如上错误

对于这个403错误,笔者刚开始在思考是不是/etc/yum.conf配置中的代理服务器返回的,于是在自己电脑上访问上面的url也是403错误

后又想了下,代理服务器应该也不会干这样的事,应该更可能还是服务器自身的问题,

对于yum,红帽系统是使用到了订阅这个概念的,于是检查,license及订阅信息,结果如下:

[root@qq_5201351 ~]# subscription-manager list
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux Server
Product ID:     69
Version:        6.10
Arch:           x86_64
Status:         Subscribed
Status Details:
Starts:         05/30/2020
Ends:           05/30/2021

看着也没有问题啊,最后反复看到上面的报错信息,猛然发现了有个链接,https://access.redhat.com/solutions/69319

不过好像需要订阅了的才能看到详情,解决方案的大体意思是要重新注册订阅,于是重新注册后,问题得到解决!

If an still issue persists, then unregister the system and register again using the following commands:

# subscription-manager unregister
# subscription-manager clean
# subscription-manager register
Subscribe the system with the required subscription(s) or use auto subscribe option to automatically assign subscription to the system.

# subscription-manager attach --auto 
Clean yum cache and try running yum command to confirm whether yum works or not.

# yum clean all 
# yum repolist
If there is Proxy server required to connect to the internet then configure the proxy server.
In /etc/yum.conf please add the proxy details as stated in the article :
e.g.

proxy=http://mycache.mydomain.com:3128
# The account details for yum connections
proxy_username=proxy-user
proxy_password=password.

尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/13875743.html

原文地址:https://www.cnblogs.com/5201351/p/13875743.html