当前位置:首页 > linux > 正文内容

sudo apt-get update会失败,修改主机的dns的地址和更换源

root5年前 (2021-06-21)linux1567


ping google.com 不同

看本机的DNS配置信息是在:/etc/resolv.conf

发现是保留ip

修改直接vim /etc/resolv.conf

写入:

nameserver 8.8.8.8


保存之后重启一下网络服务

sudo /etc/init.d/networking restart


接下来就是修改apt的源

vim /etc/apt/sources.list

将里面的内容替换为下面的:

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse


保存


然后去执行

sudo apt-get update


扫描二维码推送至手机访问。

版权声明:本文由一叶知秋发布,如需转载请注明出处。

本文链接:https://zhiqiu.top/?id=133

分享给朋友:

相关文章

linux 慎用 kill -9 干掉程序

 kill -9 强制结束某程序的时候,如果程序的有退出信号触发处理回收子进程的,将失效。会造成僵尸进程。...

压缩&解压命令

tar 命令-c 建立压缩文档-x 解压-t 查看内容-r 向压缩归档文件末尾追加文件-u:更新原压缩包中的文件上面的参数只能使用一个,跟下面的参数连用-z:有gzip属性的-j:有bz2属性的-Z:有compress属性的-v:...

linux   挂载盘

linux 挂载盘

sudo  fdisk -l :列出所有分区信息;找到自己插入到linux系统的硬盘上图从众多盘中找到自己的 看type 和大小。/dev/sdb 是盘的名字/dev/sdb4  是分区接下来是挂载s...

shell获取当前文件路径

curPath=$(readlink -f "$(dirname "$0")") echo $curPath    #或者 curPath=$(dirname $(readli...

实用的linux命令

查看命令运行的实时结果watch  "ls |wc -l" 能够实时的监控命令执行的结果,不过刷新时间有点长,大概2秒,可以修改为1秒iftop查看出入网流量情况nload实时查看出入网流量情况fre...

Linux下查看系统版本信息

 Linux下如何查看版本信息, 包括位数、版本信息以及CPU内核信息、CPU具体型号等等,整个CPU信息一目了然。   1、# uname -a   (Linux查看版本当前操作系统内核信息)&nb...