build-essential安装指定安装源
时间: 2023-12-16 09:04:22 浏览: 75
如果你需要指定安装源来安装 `build-essential`,可以通过编辑 `/etc/apt/sources.list` 文件来实现。
1.备份 `/etc/apt/sources.list` 文件
在编辑 `/etc/apt/sources.list` 文件之前,建议你备份一下该文件,以防止操作不当造成系统问题。
```
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
2.编辑 `/etc/apt/sources.list` 文件
使用文本编辑器打开 `/etc/apt/sources.list` 文件,可以通过以下命令打开该文件:
```
sudo nano /etc/apt/sources.list
```
在该文件中添加指定源的地址,例如,如果你要使用阿里云的源,可以在文件中添加以下内容:
```
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
```
3.更新源并安装 `build-essential`
保存文件后,运行以下命令更新源并安装 `build-essential`:
```
sudo apt-get update
sudo apt-get install build-essential
```
安装完成后,可以通过以下命令验证 `build-essential` 是否安装成功:
```
gcc --version
```
希望这个回答能够帮到你!
阅读全文