云服务器使用sudo apt-get update 失败的原因及解决方法(unubtu下)
【摘要】 sudo apt-get update 失败
今天在使用云服务器安装东西的时候,更新软件包,突然发现失败了,出现了以下情况:
苦苦寻找原因,各种答案,都没能成功解决问题,后来把出错的英语翻译了一下,大概的意思就是,获取包返回失败,后来想想是不是DNS的问题,然后重点来了
我输入:cat /etc/resolv.conf
root@whcckj:~# cat /etc/resolv.conf
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "systemd-resolve --status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
search openstacklocal
标蓝的地方就是问题所在,于是我们修改这个标蓝的地方
vi /etc/resolv.conf
改成 namesever 8.8.8.8
保存退出(先按下ESC,在输入:wq,回车搞定),然后使用sudo apt-get update
【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
yd_2587518112023/07/05 03:33:021楼编辑删除举报