Step1. 备份 list 文件
进入对应文件夹,用管理员权限,执行复制操作:
cd /etc/apt/
sudo cp sources.list sources.list.bak
Step2. 修改 list 文件
通过管理员权限,使用 vim 进行修改:
sudo vim sources.list
将下列代码替换 sources.list文件内容
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
Step3. 更新软件列表
使用管理员权限,执行命令:
sudo apt-get update
sudo apt-get upgrade
注意:要更新源的前提是ubuntu能够联网。
如果出现以下情况就说明没有联网忙,所以要先解决无法联网的问题,再进行换源
错误:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic InRelease
无法解析域名“mirrors.tuna.tsinghua.edu.cn”
错误:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates InRelease
无法解析域名“mirrors.tuna.tsinghua.edu.cn”
错误:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports InRelease
无法解析域名“mirrors.tuna.tsinghua.edu.cn”
错误:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security InRelease
无法解析域名“mirrors.tuna.tsinghua.edu.cn”
错误:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-proposed InRelease
无法解析域名“mirrors.tuna.tsinghua.edu.cn”
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
所有软件包均为最新。
W: 无法下载 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic/InRelease 无法解析域名“mirrors.tuna.tsinghua.edu.cn”
W: 无法下载 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic-updates/InRelease 无法解析域名“mirrors.tuna.tsinghua.edu.cn”
W: 无法下载 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic-backports/InRelease 无法解析域名“mirrors.tuna.tsinghua.edu.cn”
W: 无法下载 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic-security/InRelease 无法解析域名“mirrors.tuna.tsinghua.edu.cn”
W: 无法下载 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic-proposed/InRelease 无法解析域名“mirrors.tuna.tsinghua.edu.cn”
W: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。
在主机为无线上网,虚拟机设定的时候最好用“桥接模式”方法如下:
- 关闭正在运行的虚拟机ubuntu,将其联网方式设定为“桥接模式”。
2. 启动ubuntu虚拟机即可文章来源:https://www.toymoban.com/news/detail-430782.html
附:国内常见源文章来源地址https://www.toymoban.com/news/detail-430782.html
阿里云:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
中科大:
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
网易:
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
清华:
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
到了这里,关于Ubuntu18 更换 apt 源为阿里云的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!