首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Centos -- Yum更新错误--“HTTP错误403 -禁止”

Centos -- Yum更新错误--“HTTP错误403 -禁止”
EN

Stack Overflow用户
提问于 2021-01-21 20:19:36
回答 1查看 3.1K关注 0票数 0

最近,我开发了一个运行CentOS Linux 7的Docker容器。在我的办公室里,我们有一个代理服务器,所以一旦容器打开,我就会安慰并手动设置代理:

代码语言:javascript
运行
复制
[me@8adfa83bb9e2 /home/me]#
[me@8adfa83bb9e2 /home/me]# export http_proxy="http://10.10.10.101:8888"
[me@8adfa83bb9e2 /home/me]#

在另外一篇这样的文章中,我了解了如何在/etc/yum.conf文件中设置代理。因此,我在我的/etc/yum.conf文件中添加了以下一行:

代码语言:javascript
运行
复制
proxy=http://10.10.10.101:8888

然后我做了一个“yum clean metadata”:

代码语言:javascript
运行
复制
[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”:

代码语言:javascript
运行
复制
[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容器可以解决和ping mirrorlist.centos.org。我试图使用wget来删除这个URL,但是容器没有安装wget。当我在主机上尝试相同的操作时:

代码语言:javascript
运行
复制
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机器。

苏柔欧…从我的主机系统看来,yum服务是“不可用的”。但是在我的环境中,我已经在许多其他的Centos机器上运行了“yum update”。不知道这里有什么不同。有人见过这个吗?谢谢。

EN

Stack Overflow用户

发布于 2021-01-25 15:21:55

对于任何可能看过这篇文章的人来说.问题是代理服务器问题。一旦我在(主机和容器)上设置了代理服务器设置,问题就消失了。我认为在上面的文章中,我会在容器上设置代理,而不是在主机上设置,并且在执行"yum更新“时,主机正在NAT‘in容器的IP地址。

票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65835145

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档