执行yum install ntpdate ‐y报错Could not resolve host: download.example; 未知的名称或服务

Posted 我是廖志伟

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了执行yum install ntpdate ‐y报错Could not resolve host: download.example; 未知的名称或服务相关的知识,希望对你有一定的参考价值。

#Kubernetes安装教程#
遇到的问题文章出处:https://blog.csdn.net/java_wxid/article/details/127967699

遇到的问题:设置时间同步步骤时,执行以下命令yum install ntpdate ‐y

报错(参考报错提示.txt)

尝试解决:
1.设置了docker加速url:http://hub-mirror.c.163.com 没起作用
2.根据报错信息《Could not resolve host: mirrorlist.centos.org; 未知的错误》 怀疑是什么配置导致我的网络无法连接了,尝试使用命令:ping baidu.com测试网络连通性。提示:ping: www.baidu.com: 域名解析暂时失败。

这个时候就去解决这个问题了,尝试vim /etc/dhcpcd.conf添加static domain_name_servers=114.114.114.114保存之后,reboot重启之后,重新尝试ping baidu.com。发现通了。继续执行,yum install ntpdate ‐y命令,发现还是一样报错。《Could not resolve host: download.example; 未知的名称或服务》

这个时候就去解决这个问题了,尝试解决这个问题,vim /etc/sysconfig/network-scripts/ifcfg-eno16777736
增加这三行

DNS1=8.8.8.8
 DNS2=114.114.114.114
 PEERDNS=no

重启网络service network restart
报错:

Restarting network (via systemctl):  Job for network.service failed because the control process exited with error 
code. See "systemctl status network.service" and "journalctl -xe" for details.

一气之下重启了机器:reboot

继续执行,yum install ntpdate ‐y命令
发现又出现新的问题:

[root@k8s-master ~]# yum install ntpdate ‐y
已加载插件:fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

/var/run/yum.pid 已被锁定,PID3885 的另一个程序正在运行。
Another app is currently holding the yum lock; waiting for it to exit...
  另一个应用程序是:PackageKit
    内存:285 M RSS879 MB VSZ)
    已启动: Fri Dec  9 23:13:09 2022 - 00:05之前
    状态  :睡眠中,进程ID3885
Another app is currently holding the yum lock; waiting for it to exit...
  另一个应用程序是:PackageKit
    内存:285 M RSS879 MB VSZ)
    已启动: Fri Dec  9 23:13:09 2022 - 00:07之前
    状态  :睡眠中,进程ID3885
^C

Exiting on user cancel.

尝试解决这个问题,编辑/etc/yum/pluginconf.d/langpacks.conf文件将第一行:enable=1改为enable=0,保存之后,还是不起作用,尝试rm -f /var/run/yum.pid强制关掉yum进程。还是不行,错误提示还是跟文本中的一样。

这个时候注意到了这个提示《https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes%E2%80%90el7%E2%80%90x86_64/repodata/repomd.xml:[Errno 14] HTTPS Error 404 - Not Found》

怀疑有可能是添加k8s yum源步骤的时候,老师给的配置连接失效了,配置如下:
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes‐el7‐x86_64

直接访问没什么作用,不知道是不是这个原因?

错误提示文本如下(示例):

[root@k8s-master ~]# yum install ntpdate ‐y
已加载插件:fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile
 * base: mirrors.nju.edu.cn
 * centos-sclo-rh: mirrors.nju.edu.cn
 * extras: ftp.sjtu.edu.cn
 * updates: mirrors.nju.edu.cn
http://download.example/pub/epel/7/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: download.example; 未知的名称或服务"
正在尝试其它镜像。
https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes%E2%80%90el7%E2%80%90x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found
正在尝试其它镜像。
To address this issue please refer to the below wiki article 

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.



 One of the configured repositories failed (Kubernetes),
 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=kubernetes ...

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

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

failure: repodata/repomd.xml from kubernetes: [Errno 256] No more mirrors to try.
https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes‐el7‐x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found

以上是关于执行yum install ntpdate ‐y报错Could not resolve host: download.example; 未知的名称或服务的主要内容,如果未能解决你的问题,请参考以下文章

执行yum install ntpdate ‐y报错Could not resolve host: download.example; 未知的名称或服务

每天学一个 Linux 命令(96):ntpdate

为啥在虚拟机安装mysql命令报错yum install -y mariadb mariadb-server python2-PyMySQL?

CentOS设置系统时间与网络时间同步

yum -y install python-devel

sdfsdfsdfsdf