Linux报错解决1_阿里云ecs不能使用yum的任何指令、安装docker执行yum makecache fast 报错

一、问题描述

开始的时候yum还能用,配置项目环境的时候不知道执行了那句指令导致的

好像是yum clean allyum makecache这两句,执行完之后一直 报错try other mirrors....,只要跟yum相关指令都会报错

现在要安装docker,执行完

sudo yum install -y yum-utils 和 设置阿里镜像仓库yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

接下来更新yum软件包索引yum makecache fast 报错

[root@iZ2vc8owmlobwkazif1efpZ yum.repos.d]# yum makecache fast
Loaded plugins: fastestmirror, langpacks, update-motd
Loading mirror speeds from cached hostfile
base                                                                                                                                                                | 3.1 kB  00:00:00     
https://download.docker.com/linux/centos/2.1903/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.


 One of the configured repositories failed (Docker CE Stable - x86_64),
 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. Run the command with the repository temporarily disabled
            yum --disablerepo=docker-ce-stable ...

     4. Disable the repository permanently, 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 docker-ce-stable
        or
            subscription-manager repos --disable=docker-ce-stable

     5. 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=docker-ce-stable.skip_if_unavailable=true

failure: repodata/repomd.xml from docker-ce-stable: [Errno 256] No more mirrors to try.
https://download.docker.com/linux/centos/2.1903/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found

不知道是哪的问题,在执行yum clean + yum makecache 报错

[root@iZ2vc8owmlobwkazif1efpZ yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, langpacks, update-motd
Cleaning repos: docker-ce-stable
Cleaning up list of fastest mirrors
[root@iZ2vc8owmlobwkazif1efpZ yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, langpacks, update-motd
Determining fastest mirrors
https://download.docker.com/linux/centos/2.1903/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.


 One of the configured repositories failed (Docker CE Stable - x86_64),
 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. Run the command with the repository temporarily disabled
            yum --disablerepo=docker-ce-stable ...

     4. Disable the repository permanently, 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 docker-ce-stable
        or
            subscription-manager repos --disable=docker-ce-stable

     5. 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=docker-ce-stable.skip_if_unavailable=true

failure: repodata/repomd.xml from docker-ce-stable: [Errno 256] No more mirrors to try.
https://download.docker.com/linux/centos/2.1903/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found

二、问题解决

在这里插入图片描述

将 /etc/yum.repos.d下 只留下 AliYun.repo

然后执行yum clean + yum makecache 发现不报错了

在安装docker之前,yum就已经出问题了,报错,一直try other mirrors…,所以我推测之前出问题是epel.repo的原因,

它是跟软件包更新相关,删了之后yum指令貌似都行了

然后执行 yum -y update 也不报错了顺利更新

但是,重新配置docker的阿里云镜像地址之后,执行yum makecache fast还是报错,按照命令行的提示

		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=docker-ce-stable.skip_if_unavailable=true

然后发现不在报错

[root@iZ2vc8owmlobwkazif1efpZ yum.repos.d]# yum makecache fast
Loaded plugins: fastestmirror, langpacks, update-motd
Loading mirror speeds from cached hostfile
base                                                                                                                                                                | 3.1 kB  00:00:00     
https://download.docker.com/linux/centos/2.1903/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
extras                                                                                                                                                              | 2.5 kB  00:00:00     
plus                                                                                                                                                                | 2.5 kB  00:00:00     
updates                                                                                                                                                             | 2.9 kB  00:00:00     
Metadata Cache Created

但是按照docker官网执行安装还是不行,404,…

[root@iZ2vc8owmlobwkazif1efpZ yum.repos.d]# sudo yum install docker-ce docker-ce-cli containerd.io
Loaded plugins: fastestmirror, langpacks, update-motd
Loading mirror speeds from cached hostfile
https://download.docker.com/linux/centos/2.1903/x86_64/stable/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
Trying other mirror.
No package docker-ce available.
No package docker-ce-cli available.
No package containerd.io available.
Error: Nothing to do

最后只能按照阿里云官方提供的 部署 docker的方法,才安装成功,见:https://help.aliyun.com/document_detail/51853.html#section-gtl-cjs-ls2

在这里插入图片描述

三、小结

  • epel源可能导致yum指令报错的,可以删除,之后如果想安装可以执行 yum install -y epel-release
  • ecs上面我的系统镜像是Alibaba Cloud Linux ,docker官网安装的方式不成功,最后使用阿里云官方推荐部署方式才成功

猜你喜欢

转载自blog.csdn.net/qq_24654501/article/details/115419572