解决:[Errno 14] curl#6 - “Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error“


解决:selenium.common.exceptions.JavascriptException: Message: javascript error: $ is not defined





背景

在搭建需要的代码环境时,报错:

Loading mirror speeds from cached hostfile Could not retrieve
mirrorlist
http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock
error was 14: curl#6 - “Could not resolve host: mirrorlist.centos.org;
未知的错误”

One of the configured repositories failed (未知), 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=<repoid> ...

 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 <repoid>
    or
        subscription-manager repos --disable=<repoid>

 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=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64



报错问题


Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"


 One of the configured repositories failed (未知),
 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=<repoid> ...

     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 <repoid>
        or
            subscription-manager repos --disable=<repoid>

     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=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64


截图如下:

在这里插入图片描述



报错翻译

主要报错信息内容翻译如下所示:


Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"


 One of the configured repositories failed (未知),
 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=<repoid> ...

     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 <repoid>
        or
            subscription-manager repos --disable=<repoid>

     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=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

翻译:


从缓存的hostfile加载镜像速度
无法检索镜像列表http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock错误是
14: curl#6 - "无法解析host: mirrorlist.centos.org;未知的错误"
​
​
其中一个配置的存储库失败(未知),
而且百胜没有足够的缓存数据来继续。此时唯一的
百胜能做的安全的事就是失败。有几种方法可以“修复”这个问题:
​
1. 与上游的仓库联系,让他们解决问题。
​
2. 重新配置baseurl/etc。对于存储库,指向一个工作的
上游。如果您使用的是较新的版本,这通常是非常有用的
发行版版本比存储库(和
以前发行版的包仍然可以使用)。
​
3. 在暂时禁用存储库的情况下运行命令
Yum——disablerepo=<repoid>…
​
4. 永久禁用存储库,这样yum就不会默认使用它。好吃。
然后忽略存储库,直到永久启用它
再次使用——enablerepo来临时使用:
​
Yum-config-manager——disable <repoid>
或
订阅管理器repos——disable=<repoid>
​
5. 如果失败存储库不可用,则将其配置为跳过。
请注意,yum将尝试联系回购。当它运行大多数命令时,
所以每次都要尝试失败。百胜将会有很多
慢)。如果这是一个非常临时的问题,这通常是一个很好的方法
妥协:
​
Yum-config-manager——save——setopt=<repoid>.skip_if_unavailable=true
​
无法为repo: base/7/x86_64找到有效的base



报错原因

经过查阅资料,发现出现"[Errno 14] curl#6 - ‘Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error’"错误的原因是非阿里云ECS用户无法解析主机“mirrors.cloud.aliyuncs.com”,只需将CentOS-Base里包含aliyuncs.com的行删除即可。

小伙伴们按下面的解决方法即可解决!!!



解决方法

要解决这个错误,这里总结了以下几个步骤。

步骤一 备份原源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

步骤二 下载阿里源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

步骤三 替换源地址

sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

步骤四 刷新缓存

yum makecache

步骤五 更新

yum -y update

步骤六 测试

yum repolist

如果能够显示yum源列表,则说明本地yum源配置成功。 否则,请检查配置文件是否正确并重新执行命令

yum clean all

再次检查yum源列表是否显示。

步骤七 修改DNS

当步骤六源列表不显示时的解决方案,就是修改DNS。输入以下命令:

//进入编辑模式

vim /etc/resolv.conf

插入:

nameserver 8.8.8.8
nameserver 8.8.4.4

保存并退出



今天的分享就到此结束了

欢迎点赞评论关注三连

在这里插入图片描述

  • 18
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ninghes

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值