命令ubuntu22.04下更改国内源
时间: 2023-05-25 07:05:59 浏览: 743
ubuntu22.04 root 启动音频服务
以下是在Ubuntu 22.04下更改国内源的命令:
1.备份源列表文件:
```bash
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
2.打开源列表文件:
```bash
sudo nano /etc/apt/sources.list
```
3.将文件中的所有内容替换为以下内容:
```bash
###### Ubuntu Main Repos
deb http://cn.archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
###### Ubuntu Update Repos
deb http://cn.archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb http://cn.archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://cn.archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
###### Canonical Partners
deb http://archive.canonical.com/ubuntu focal partner
deb-src http://archive.canonical.com/ubuntu focal partner
```
4.保存文件并退出编辑器。
5.更新源列表:
```bash
sudo apt-get update
```
6.更改源后,可以使用以下命令来清理旧的软件包和依赖项:
```bash
sudo apt-get autoremove
```
7.完成。现在您已经成功更改了Ubuntu 22.04的国内源。
阅读全文