ubantu怎么切换阿里云
时间: 2023-05-28 17:01:56 浏览: 108
您可以按照以下步骤在Ubuntu下切换到阿里云镜像源:
1. 打开终端(快捷键为Ctrl+Alt+T);
2. 输入以下命令,备份原始镜像源文件:
```
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
3. 输入以下命令,打开源列表进行编辑:
```
sudo gedit /etc/apt/sources.list
```
4. 在源列表文件中,注释掉原始镜像源信息,并添加阿里云的源信息,可以选择如下两种方式:
*(1)使用中科大的Ubuntu镜像源(推荐)*
将原始镜像源信息注释掉,复制以下内容粘贴到源列表文件中:
```
deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
```
*(2)使用阿里云的Ubuntu镜像源*
将原始镜像源信息注释掉,复制以下内容粘贴到源列表文件中:
```
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-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-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
```
5. 保存并关闭源列表,然后运行以下命令更新源:
```
sudo apt-get update
```
更新后就可以使用阿里云镜像源了。
阅读全文