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

简介: 执行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 已被锁定,PID 为 3885 的另一个程序正在运行。
Another app is currently holding the yum lock; waiting for it to exit...
  另一个应用程序是:PackageKit
    内存:285 M RSS (879 MB VSZ)
    已启动: Fri Dec  9 23:13:09 2022 - 00:05之前
    状态  :睡眠中,进程ID:3885
Another app is currently holding the yum lock; waiting for it to exit...
  另一个应用程序是:PackageKit
    内存:285 M RSS (879 MB VSZ)
    已启动: Fri Dec  9 23:13:09 2022 - 00:07之前
    状态  :睡眠中,进程ID:3885
^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
相关实践学习
容器服务Serverless版ACK Serverless 快速入门:在线魔方应用部署和监控
通过本实验,您将了解到容器服务Serverless版ACK Serverless 的基本产品能力,即可以实现快速部署一个在线魔方应用,并借助阿里云容器服务成熟的产品生态,实现在线应用的企业级监控,提升应用稳定性。
云原生实践公开课
课程大纲 开篇:如何学习并实践云原生技术 基础篇: 5 步上手 Kubernetes 进阶篇:生产环境下的 K8s 实践 相关的阿里云产品:容器服务 ACK 容器服务 Kubernetes 版(简称 ACK)提供高性能可伸缩的容器应用管理能力,支持企业级容器化应用的全生命周期管理。整合阿里云虚拟化、存储、网络和安全能力,打造云端最佳容器化应用运行环境。 了解产品详情: https://www.aliyun.com/product/kubernetes
相关文章
|
6月前
yum install、localinstall和groupinstall区别
yum install、localinstall和groupinstall区别
|
5月前
|
Linux Apache
Linux【环境部署 02】yum源镜像下载+挂载镜像+本地yum源配置+局域网yum源服务搭建+局域网yum源使用(一篇学会离线yum源配置)
Linux【环境部署 02】yum源镜像下载+挂载镜像+本地yum源配置+局域网yum源服务搭建+局域网yum源使用(一篇学会离线yum源配置)
551 0
|
13天前
|
应用服务中间件 nginx
yum 安装报错 No package nginx available Error:Nothing to do
yum 安装报错 No package nginx available Error:Nothing to do
37 1
|
22天前
|
Python
yum 安装报错 File "/usr/bin/yum", line 30
yum 安装报错 File "/usr/bin/yum", line 30
10 0
|
4月前
yum 报错:Another app is currently holding the yum lock; waiting for it to exit
开发过程中需要用到 yum 命令 有时候执行 yum 会报错如下
19 0
|
9月前
|
缓存
yum install ansible无法直接安装Ansible的解决方法
准备三台机器: server.example.com node1.example.com node2.example.com 配置IP,主机名,/etc/hosts
319 0
|
9月前
|
消息中间件 Linux
centos7 yum快速安装rabbitmq服务
centos7 yum快速安装rabbitmq服务
139 0
|
5月前
|
测试技术 Linux
收集yum install安装的软件的全量依赖 rpm 包
收集yum install安装的软件的全量依赖 rpm 包
75 0
|
6月前
Cannot download repomd.xml解决CentOS8 yum安装AppStream报错
Cannot download repomd.xml解决CentOS8 yum安装AppStream报错
|
6月前
|
Linux
Centos yum报错: BDB1507 Thread died in Berkeley DB library
Centos yum报错: BDB1507 Thread died in Berkeley DB library