ubuntu清华源换源
时间: 2023-11-08 19:02:58 浏览: 110
要将Ubuntu的软件源更换为清华源,可以按照以下步骤进行操作:
1. 打开终端。
2. 备份原有的软件源列表文件,可以使用以下命令:
```
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
3. 编辑软件源列表文件,使用以下命令打开编辑器:
```
sudo nano /etc/apt/sources.list
```
4. 将原有的软件源地址注释掉,将以下清华源地址添加到文件中(根据您的Ubuntu版本选择相应的源):
- Ubuntu 16.04:
```
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
```
- Ubuntu 18.04:
```
deb 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 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
```
- Ubuntu 20.04:
```
deb 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 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
```
5. 保存更改(按 Ctrl + O),然后关闭编辑器(按 Ctrl + X)。
6. 更新软件包列表,使用以下命令:
```
sudo apt update
```
现在您的Ubuntu系统的软件源已经更换为清华源。
阅读全文