配置Ubuntu軟件源

小云
136
2023-09-13 09:05:19

在Ubuntu系統(tǒng)中,可以通過編輯 `/etc/apt/sources.list` 文件來配置軟件源。打開終端,輸入以下命令:

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

在打開的文件中,可以看到已經(jīng)配置的軟件源??梢愿鶕?jù)需要注釋或者取消注釋相應(yīng)的源。

常用的軟件源包括官方源、阿里云源、清華大學(xué)源等。

官方源配置示例:

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

配置完成后,保存文件并退出編輯器。然后在終端中執(zhí)行以下命令更新軟件源:

```
sudo apt update
```

現(xiàn)在,系統(tǒng)的軟件源已經(jīng)配置完成??梢允褂?`apt` 命令安裝、更新、卸載軟件包了。

0