sudo apt date 的时候换源阿里云镜像问题
执行sudo apt-get update
出现类似以下问题
Err:1 http://mirrors.163.com/ubuntu focal InRelease Temporary failure resolving ‘mirrors.163.com’
(忘截图了···)
一开始,以为是国内源有问题,更改了中科大,清华,163之后均失败。
类似的
Err:1 http://mirrors.cloud.aliyuncs.com/ubuntu focal/universe amd64 lrzsz amd64 0.12.21-10
Could not resolve 'mirrors.cloud.aliyuncs.com'
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/pool/universe/l/lrzsz/lrzsz_0.12.21-10_amd64.deb Could not resolve 'mirrors.cloud.aliyuncs.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
参考https://blog.csdn.net/aiqinchao/article/details/89522180
ping www.baidu.com 失败,果然没有联网。
首先,NAT没问题,
参考VMware 虚拟机如何连接网络,检查物理机的网络状态:https://blog.csdn.net/qq_37131111/article/details/54000029
没有问题。解决失败。 image.png
image.png
最后,参考解决VMware虚拟机无法联网问题,还原了虚拟机网络默认设置,解决成功。(别忘了,设置成功后重启虚拟机,再ping一下百度,成功)
https://blog.csdn.net/qq_43432935/article/details/91357761?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.edu_weight&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.edu_weight
————————————————
Err:1 http://mirrors.aliyun.com/ubuntu focal InRelease
Temporary failure resolving ‘mirrors.aliyun.com’
描述:在Ubuntu 20.04编辑/etc/apt/sources.list文件,更改为阿里源之后,更新执行sudo apt update,
报错:
Err:1 http://mirrors.aliyun.com/ubuntu focal InRelease
Temporary failure resolving 'mirrors.aliyun.com'
Err:2 http://mirrors.aliyun.com/ubuntu focal-security InRelease
Temporary failure resolving 'mirrors.aliyun.com'
Err:3 http://mirrors.aliyun.com/ubuntu focal-updates InRelease
Temporary failure resolving 'mirrors.aliyun.com'
1、sudo vi /etc/resolv.conf
加上(一定是加上哈)
nameserver 8.8.8.8
nameserver 114.114.114.114
如果只是执行vi /etc/resolv.conf 会报错没有办法保存退出
解决用vi修改文件,保存文件时,提示“readonly option is set”
E45: '[readonly](https://so.csdn.net/so/search?q=readonly&spm=1001.2101.3001.7020)' option is set (add ! to override)
原因分析:当前用户没有权限进行这种操作。
输入::wq!也不可以
解决方法
vi /etc/my.cnf 保存修改时出现 “readonly option is set”
方法一 强行修改
改用
sudo vi /etc/my.cnf 编辑
:wq! 保存退出即可
方法二 修改文件权限
第一步 查看权限
ls -l /etc/my.cnf
第二步 修改权限
sudo chomd 664
输入密码
第三步 修改文件
vi /etc/my.cnf
:wq! 保存退出 即可
2、然后执行命令:
resolvconf -u
3、sudo apt-get update
4、在下载就可以了
补充
ubuntu 20.04(focal) 配置如下
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse