我使用 Yum 安装软件包时遇到错误

我使用 Yum 安装软件包时遇到错误
[ec2-user@ip-172-31-27-82 ~]$ sudo yum install yum-utils
Loaded plugins: priorities, update-motd, upgrade-helper
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 5000 milliseconds')
Trying other mirror.
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 5001 milliseconds')
Trying other mirror.
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 5001 milliseconds')
Trying other mirror.
Could not retrieve mirrorlist http://repo.ap-south-1.amazonaws.com/latest/main/mirror.list error was
12: Timeout on http://repo.ap-south-1.amazonaws.com/latest/main/mirror.list: (28, 'Connection timed out after 5000 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

我试过

yum clean all
yum repolist

错误仍然存​​在

的输出sudo yum repolist all

[ec2-user@ip-172-31-27-82 ~]$ sudo yum repolist all
Loaded plugins: priorities, update-motd, upgrade-helper
Could not retrieve mirrorlist http://repo.ap-south-1.amazonaws.com/latest/main/mirror.list error was
12: Timeout on http://repo.ap-south-1.amazonaws.com/latest/main/mirror.list: (28, 'Connection timed out after 5000 milliseconds')
CentOS/primary_db              FAILED                                          
http://mirror.centos.org/centos/7/os/x86_64/repodata/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2: [Errno 12] Timeout on http://mirror.centos.org/centos/7/os/x86_64/repodata/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2: (28, 'Connection timed out after 5000 milliseconds')
Trying other mirror.
CentOS/primary_db              FAILED                                          
http://mirror.centos.org/centos/7/os/x86_64/repodata/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2: [Errno 12] Timeout on http://mirror.centos.org/centos/7/os/x86_64/repodata/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2: (28, 'Connection timed out after 5000 milliseconds')
Trying other mirror.
CentOS/primary_db              FAILED                                          
http://mirror.centos.org/centos/7/os/x86_64/repodata/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2: [Errno 12] Timeout on http://mirror.centos.org/centos/7/os/x86_64/repodata/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2: (28, 'Connection timed out after 5000 milliseconds')
Trying other mirror.
http://mirror.centos.org/centos/7/os/x86_64/repodata/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2: [Errno 12] Timeout on http://mirror.centos.org/centos/7/os/x86_64/repodata/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2: (28, 'Connection timed out after 5000 milliseconds')
Trying other mirror.
http://mirror.centos.org/centos/7/os/x86_64/repodata/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2: [Errno 12] Timeout on http://mirror.centos.org/centos/7/os/x86_64/repodata/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2: (28, 'Connection timed out after 5000 milliseconds')
Trying other mirror.
http://mirror.centos.org/centos/7/os/x86_64/repodata/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2: [Errno 12] Timeout on http://mirror.centos.org/centos/7/os/x86_64/repodata/0c34273ad0292747ee5e15c047d3e51c67ca59861a446972db45d71abacc7ad7-primary.sqlite.bz2: (28, 'Connection timed out after 5000 milliseconds')
Trying other mirror.
Could not retrieve mirrorlist http://repo.ap-south-1.amazonaws.com/latest/updates/mirror.list error was
12: Timeout on http://repo.ap-south-1.amazonaws.com/latest/updates/mirror.list: (28, 'Connection timed out after 5000 milliseconds')
repo id                                                                        repo name                                                                status
CentOS                                                                         centos                                                                   enabled: 0
amzn-main/latest                                                               amzn-main-Base                                                           enabled: 0
amzn-main-debuginfo/latest                                                     amzn-main-debuginfo                                                      disabled
amzn-main-source/latest                                                        amzn-main-source                                                         disabled
amzn-nosrc/latest                                                              amzn-nosrc-Base                                                          disabled
amzn-preview/latest                                                            amzn-preview-Base                                                        disabled
amzn-preview-debuginfo/latest                                                  amzn-preview-debuginfo                                                   disabled
amzn-preview-source/latest                                                     amzn-preview-source                                                      disabled
amzn-updates/latest                                                            amzn-updates-Base                                                        enabled: 0
amzn-updates-debuginfo/latest                                                  amzn-updates-debuginfo                                                   disabled
amzn-updates-source/latest                                                     amzn-updates-source                                                      disabled
repolist: 0


Loaded plugins: priorities, update-motd, upgrade-helper
CentOS                                                                                                                                     | 3.6 kB  00:00:00     
Could not retrieve mirrorlist http://repo.ap-south-1.amazonaws.com/latest/updates/mirror.list error was
12: Timeout on http://repo.ap-south-1.amazonaws.com/latest/updates/mirror.list: (28, 'Connection timed out after 5001 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-updates/latest

答案1

正如 @IgnacioVazquez-Abrams 提到的,您没有网络连接,因此yum无法安装软件包

答案2

我已经看过一些了,可能是你在代理后面。我添加了以下内容:

proxy=http<your FQDN proxy settings including port here>

...到文件/etc/yum.conf(我使用的是 CentOS 7)

华泰

相关内容