如何在 Ubuntu 16.04 上使用源 URI 自动更新 /etc/apt/sources.list?

Håk*_*and 12 apt 16.04

以下命令在 Ubuntu 15.10 上运行良好:

sudo apt-get build-dep emacs24
Run Code Online (Sandbox Code Playgroud)

但是,在 Ubuntu 16.04 上运行时出现以下错误:

Reading package lists... Done
E: You must put some 'source' URIs in your sources.list
Run Code Online (Sandbox Code Playgroud)

在15.10所有行(在数量约10)与deb-src/etc/apt/sources.list其中取消注释,而在16.04相应线,其中注释。例如,这是我当前的 4 行sources.list

## Major bug fix updates produced after the final release of the
## distribution.
deb http://no.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src http://no.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
Run Code Online (Sandbox Code Playgroud)

这种变化的原因是什么?

接下来,我想避免/etc/apt/sources.list每次重新安装 Ubuntu 时都进行手动编辑。这(取消注释deb-src行)如何自动完成?

小智 14

我在 Ubuntu 16.04 的服务器安装上遇到了同样的问题,所以没有 GUI。我所需要的只是几个sed命令。

sudo sed -i -- 's/#deb-src/deb-src/g' /etc/apt/sources.list && sudo sed -i -- 's/# deb-src/deb-src/g' /etc/apt/sources.list
Run Code Online (Sandbox Code Playgroud)

然后sudo apt-get update继续。


Gun*_*son 10

打开软件和更新并启用“源代码”。

  • 如果你的 ubuntu 是一个只有 shell 的服务器就没用 (16认同)