ubuntu20.04.6 apt更换国内源
时间: 2023-10-13 18:06:31 浏览: 424
Ubuntu 20.04.4升级20.04.6离线资源包
可以按照以下步骤更换 Ubuntu 20.04.6 的软件源为国内源:
1.备份原有的源文件。打开终端,输入以下命令备份原有的源文件:
```
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
2.修改源文件。使用编辑器打开源文件:
```
sudo nano /etc/apt/sources.list
```
3.将文件中的内容替换为以下内容(可根据需求选择不同的国内源):
```
# 清华大学源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# 阿里云源
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
```
4.保存修改。按 Ctrl + X,然后按 Y 确认保存。
5.更新软件源。执行以下命令更新软件源:
```
sudo apt-get update
```
6.完成。现在您已经成功更换了 Ubuntu 20.04.6 的软件源为国内源。
阅读全文