配置ubuntu代码源
时间: 2024-06-12 13:10:11 浏览: 142
配置 Ubuntu 的软件源可以通过以下步骤完成:
1. 打开终端,输入以下命令备份原有的源列表文件:
```
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
2. 编辑源列表文件,选择合适的源地址,例如使用阿里云的源:
```
sudo vim /etc/apt/sources.list
```
在文件中添加以下内容:
```
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
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-security main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-security 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-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
```
3. 更新软件源:
```
sudo apt-get update
```
4. 完成。
阅读全文
相关推荐


















