ubuntu更换国内源
时间: 2023-10-14 07:05:43 浏览: 46
Ubuntu20.04 更换国内源详细过程
5星 · 资源好评率100%
1. 打开终端,输入以下命令,备份原有的sources.list文件:
```
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
2. 打开sources.list文件:
```
sudo gedit /etc/apt/sources.list
```
3. 将原有的源地址全部注释掉,添加以下内容(以阿里云源为例):
```
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-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports 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
```
注意:上面的源地址适用于Ubuntu 20.04版本,如果你的版本不同,请复制对应版本的源地址。
4. 保存文件并退出gedit。
5. 更新软件包信息:
```
sudo apt-get update
```
6. 更新软件包:
```
sudo apt-get upgrade
```
7. 完成,现在你已经更换了国内源。
阅读全文