Centos - Yum更新错误- " HTTP错误403 -禁止"



我最近启动了一个运行CentOS Linux version 7的Docker容器。在我的办公室里,我们有一个代理服务器,所以一旦容器启动,我就手动控制并设置代理:

[me@8adfa83bb9e2 /home/me]#
[me@8adfa83bb9e2 /home/me]# export http_proxy="http://10.10.10.101:8888"
[me@8adfa83bb9e2 /home/me]#

在单独的SO帖子中,我了解了如何在/etc/yum.conf文件中设置代理。因此,我在/etc/yum.conf文件中添加了以下行:

proxy=http://10.10.10.101:8888

然后是"yum clean metadata"

[me@8adfa83bb9e2 /home/me]# yum clean metadata
Loaded plugins: fastestmirror, ovl
Cleaning repos: base extras updates
0 metadata files removed
0 sqlite files removed
0 metadata files removed
[me@8adfa83bb9e2 /home/me]#
在这一点上,我想我可以回家了。我做了一个"yum update":
[me@8adfa83bb9e2 /home/me]#
[me@8adfa83bb9e2 /home/me]# yum update
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was
14: HTTP Error 403 – Forbidden
...and then a lot more stuff here...

嗯。"HTTP错误403"。这对我来说是个新问题;我习惯运行"yum update",它只是自动工作。

这不是DNS问题;Docker容器可以解析和pingmirrorlist.centos.org。我试图使用wget拉下该URL,但容器没有安装wget。当我在主机上尝试同样的事情时:

me@hostmachine:/home/me$
me@hostmachine:/home/me$
me@hostmachine:/home/me$ sudo wget http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container
[1] 7039
[2] 7040
[3] 7041
[2]   Done                    arch=x86_64
me@hostmachine:/home/me$
Redirecting output to ‘wget-log’.
[1]-  Exit 8                  sudo wget http://mirrorlist.centos.org/?release=7
[3]+  Done                    repo=os
me@hostmachine:/home/me$
me@hostmachine:/home/me$
me@hostmachine:/home/me$ ls -l
total 4
-rw-r--r-- 1 root root 382 Jan 21 19:55 wget-log
me@hostmachine:/home/me$
me@hostmachine:/home/me$
me@hostmachine:/home/me$ more wget-log
--2021-01-21 19:55:31--  http://mirrorlist.centos.org/?release=7
Resolving mirrorlist.centos.org (mirrorlist.centos.org)... 147.75.69.225, 18.225.36.18, 67.219.148.138, ...
Connecting to mirrorlist.centos.org (mirrorlist.centos.org)|147.75.69.225|:80... connected.
HTTP request sent, awaiting response... 503 Service Unavailable
2021-01-21 19:55:31 ERROR 503: Service Unavailable.
me@hostmachine:/home/me$
me@hostmachine:/home/me$

(是的,主机有正确的代理设置。它不是Centos机器

Soooooooo…它看起来像百胜餐饮服务是"不可用"从我的主机系统。但是我已经在我的环境中的许多其他Centos机器上运行了"yum update"。不知道这里会有什么不同。有人见过这个吗?谢谢你。

供任何可能正在看这篇文章的人参考…这个问题是代理服务器的问题。一旦我在上设置代理服务器设置,主机和容器,问题就解决了。我认为在上面的帖子中,我在容器上设置代理,但不是主机,主机在做"yum update.">

时NAT转换容器的IP地址。

相关内容

最新更新