Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services Amazon EC2实例可以';t更新或使用yum或up2date命令_Amazon Web Services_Amazon Ec2_Yum - Fatal编程技术网

Amazon web services Amazon EC2实例可以';t更新或使用yum或up2date命令

Amazon web services Amazon EC2实例可以';t更新或使用yum或up2date命令,amazon-web-services,amazon-ec2,yum,Amazon Web Services,Amazon Ec2,Yum,我正在使用亚马逊的教程。前几条说明涉及使用yum,但我尝试的每一种方法都会产生相同的消息。我最近发现了一些关于同一问题的其他问题,这些问题都没有改变我的设置 信息如下: Loaded plugins: priorities, update-motd, upgrade-helper Could not retrieve mirrorlist http://repo.us-east-1.amazonaws.com/latest/main/mirror.list error was 12: Timeo

我正在使用亚马逊的教程。前几条说明涉及使用
yum
,但我尝试的每一种方法都会产生相同的消息。我最近发现了一些关于同一问题的其他问题,这些问题都没有改变我的设置

信息如下:

Loaded plugins: priorities, update-motd, upgrade-helper
Could not retrieve mirrorlist http://repo.us-east-1.amazonaws.com/latest/main/mirror.list error was
12: Timeout on http://repo.us-east-1.amazonaws.com/latest/main/mirror.list: (28, 'Connection timed out after 10001 milliseconds')


One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:

 1. Contact the upstream for the repository and get them to fix the problem.

 2. Reconfigure the baseurl/etc. for the repository, to point to a working
    upstream. This is most often useful if you are using a newer
    distribution release than is supported by the repository (and the
    packages for the previous distribution release still work).

 3. Disable the repository, so yum won't use it by default. Yum will then
    just ignore the repository until you permanently enable it again or use
    --enablerepo for temporary usage:

        yum-config-manager --disable <repoid>

 4. Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. when it runs most commands,
    so will have to try and fail each time (and thus. yum will be be much
    slower). If it is a very temporary problem though, this is often a nice
    compromise:

        yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

 Cannot find a valid baseurl for repo: amzn-main/latest
加载的插件:优先级、更新motd、升级助手
无法检索镜像列表http://repo.us-east-1.amazonaws.com/latest/main/mirror.list 错误是
12:上的超时http://repo.us-east-1.amazonaws.com/latest/main/mirror.list: (28,“连接在10001毫秒后超时”)
其中一个配置的存储库失败(未知),
而且yum没有足够的缓存数据继续。在这一点上,唯一的
百胜可以做的安全事情就是失败。有几种方法可以“修复”此问题:
1.联系上游的存储库,让他们解决问题。
2.为存储库重新配置baseurl/etc,以指向工作
上游如果您使用的是较新的
存储库(以及
上一个发行版的包仍然有效)。
3.禁用存储库,以便默认情况下yum不会使用它。那么百胜将
只需忽略存储库,直到您再次永久启用或使用它
--临时使用的enablerepo:
yum配置管理器--禁用
4.如果失败的存储库不可用,请将其配置为跳过。
请注意,yum将尝试联系repo。当它运行大多数命令时,
因此,每次都必须尝试失败(因此,百胜将是非常重要的)
较慢)。如果这是一个非常暂时的问题,这通常是一个很好的解决方案
妥协:
yum config manager--save--setopt=.skip_if_unavailable=true
找不到repo:amzn main/latest的有效baseurl

我以前也做过同样的事情,没有遇到任何问题,使用相同的教程,但那是几个月前的事了。我不知道发生了什么变化,但我微薄的经验让我无法找到答案。

看起来主机在联系百胜服务器时遇到了问题。确保实例具有出站internet访问权限(检查安全组等)。如果实例位于VPC中,且安全组看起来不错,则可能需要使用nat设备或连接弹性IP


祝你好运-

只需将默认安全组与您可能创建的安全组一起分配即可。这解决了我的问题

很多首次使用亚马逊EC2的用户都会遇到这个问题。根据我的经验,这通常是因为没有在实例的安全组上设置允许的传出连接。Amazon配置Amazon Linux实例的教程只提到设置传入连接,因此很容易忘记您从未设置允许的传出连接。只要允许
HTTP
HTTPS
请求到任何IP地址,就可以解决这个问题

我也有同样的问题,与名字解析有关。我使用以下方法来更正:

这是Mat的一个很好的解释:

  • 请访问console.aws.amazon.com
  • 转到服务->专有网络
  • 打开您的VPC
  • 选择连接到EC2的专有网络,然后
  • 编辑摘要--->将DNS主机名更改为“是”

如果VPC上有S3端点,则这将导致yum失败,因为repo文件存储在S3中。要解决此问题,请将以下策略添加到S3:

{
"Version": "2012-10-17",
"Statement": [
    {
        "Effect": "Allow",
        "Principal": "*",
        "Action": "*",
        "Resource": [
            "arn:aws:s3:::repo.eu-west-1.amazonaws.com",
            "arn:aws:s3:::repo.eu-west-1.amazonaws.com/*"
        ]
    }
]
}
将eu-west-1替换为S3端点所在的相关地区代码。

替换为chadneal的注释。 有必要将DNS解析设置为

  • 请访问console.aws.amazon.com
  • 转到服务->专有网络
  • 打开您的VPC
  • 选择连接到EC2的专有网络
  • 单击编辑DNS解析并将其设置为是

此外,如果您无法让任何DNS工作,请检查您的DHCP选项集。我留下了一个旧的,当我清理一个涉及active directory集成的项目时,它坏了。答案是简单地更改回原始/保存的选项。

我得到了与问题中描述的相同的关于yum的错误消息。在我的例子中,我有一个NACL,它允许所有传出流量,但将传入流量限制为HTTP/HTTPS、SSH和所有ICMP。由于NACL是无状态的,因此尝试运行yum失败,因为未明确允许yum使用的传入临时连接,因此被删除。

我遇到了同样的问题,但问题不是我的安全组或NACL

背景: 我通过Route53添加了一个域名。 域名继续由DiscountASP.net托管。 VPC是手动创建的(没有向导或默认设置)。 我用我的域名和Route53提供给我的4个服务器IP地址创建了一个DHCP选项集

分析: 首先,我需要证明问题不在于安全组或NACL。 为此,我将默认DHCP选项集附加到新的VPC。成功了! 我可以进行yum更新和“curl”。没问题

然后,我使用我的域名和谷歌DNS服务器创建了一个新的DHCP选项集。 8.8.8.8 & 8.8.4.4 这也起了作用

然后,我使用路由53提供的4个DNS服务器IP中的1个,并在新的DHCP选项集中将其与我的域名一起使用。 我做了一个测试,结果失败了。我对其余4个DNS服务器IP中的2个重复了相同的测试,创建了两个单独的DHCP选项集。 我进行了测试,结果都失败了

在检查了我的域名拼写后,我只能断定问题出在域名服务器上

解决方案: 亚马逊虚拟私有云用户指南(PDF第222页) 亚马逊DNS服务器(子主题)

“当您创建专有网络时,我们会自动创建专有网络
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
#proxy=http://pos-proxy-in-my-way-of-doing-actual-real-work:666
nameserver 8.8.8.8
nameserver 8.8.4.4
yum-config-manager --disable <repoid>
yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true