温馨提示×

配置Ubuntu软件源

小云
136
2023-09-13 09:05:19
栏目: 智能运维

在Ubuntu系统中,可以通过编辑 `/etc/apt/sources.list` 文件来配置软件源。打开终端,输入以下命令:

```
sudo nano /etc/apt/sources.list
```

在打开的文件中,可以看到已经配置的软件源。可以根据需要注释或者取消注释相应的源。

常用的软件源包括官方源、阿里云源、清华大学源等。

官方源配置示例:

```
deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
```

阿里云源配置示例:

```
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
```

配置完成后,保存文件并退出编辑器。然后在终端中执行以下命令更新软件源:

```
sudo apt update
```

现在,系统的软件源已经配置完成。可以使用 `apt` 命令安装、更新、卸载软件包了。

0