Linux添加镜像源仓库
时间: 2023-11-07 08:52:50 浏览: 105
在Linux系统中,可以通过修改软件包管理工具的配置文件来添加镜像源仓库。以下是在Ubuntu系统中添加阿里云镜像源的步骤:
1. 打开终端,进入/etc/apt目录下:
```
cd /etc/apt
```
2. 备份sources.list文件:
```
sudo cp sources.list sources.list.backup
```
3. 使用文本编辑器(如nano、vim等)打开sources.list文件:
```
sudo nano sources.list
```
4. 在文件中添加阿里云的镜像源地址,可以根据自己的需要选择对应的镜像源地址:
```
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
```
5. 保存并退出编辑器,然后更新软件包列表:
```
sudo apt-get update
```
6. 添加成功后就可以使用apt命令安装软件了,例如:
```
sudo apt-get install vim
```
阅读全文