我有一个 Debian wheezy 服务器,它配置了许多源/etc/apt
似乎有很多重复的源,我想简化这一点。为了避免破坏任何东西,并错过任何软件包升级,我不想删除任何作为软件包唯一可用源的源。
我知道我可以通过使用来查看有可用升级的软件包的来源
apt-get upgrade --just-print
我如何列出全部已安装的软件包?
答案1
好问题。据我所知,从文件中删除 deb 行后,无法找出软件包的安装位置sources.list
。
保存所有来源的唯一方法如下:
% grep -h -e "^.*deb " /etc/apt/sources.list /etc/apt/sources.list.d/* | sort | uniq
deb http://apt.spideroak.com/ubuntu-spideroak-hardy/ release restricted
deb http://APT.spideroak.com/ubuntu-spideroak-hardy/ release restricted
deb http://deb.grml.org/ grml-stable main
deb http://debian.lagis.at/debian/ jessie main contrib non-free
deb http://debian.lagis.at/debian/ jessie-updates main contrib non-free
deb http://download.virtualbox.org/virtualbox/debian jessie contrib
deb http://extra.linuxmint.com betsy main
deb http://http.debian.net/debian jessie-backports main
deb http://http.debian.net/debian stretch main contrib non-free
deb http://mirror.karneval.cz/pub/linux/linuxmint/packages betsy main upstream import
deb http://repo.linrunner.de/debian jessie main
deb http://repository.spotify.com stable non-free
deb http://security.debian.org/ jessie/updates main contrib non-free
deb http://www.deb-multimedia.org jessie main non-free
为了验证我的说法我尝试了这个:
% apt-cache policy | sed -n -e "/^.[0-9]/p" | cut -f3,4 -d' ' | sort | uniq
http://apt.spideroak.com/ubuntu-spideroak-hardy/ release/restricted
http://APT.spideroak.com/ubuntu-spideroak-hardy/ release/restricted
http://deb.grml.org/ grml-stable/main
http://debian.lagis.at/debian/ jessie/contrib
http://debian.lagis.at/debian/ jessie/main
http://debian.lagis.at/debian/ jessie/non-free
http://debian.lagis.at/debian/ jessie-updates/contrib
http://debian.lagis.at/debian/ jessie-updates/main
http://debian.lagis.at/debian/ jessie-updates/non-free
http://download.virtualbox.org/virtualbox/debian/ jessie/contrib
http://extra.linuxmint.com/ betsy/main
http://http.debian.net/debian/ jessie-backports/main
http://mirror.karneval.cz/pub/linux/linuxmint/packages/ betsy/import
http://mirror.karneval.cz/pub/linux/linuxmint/packages/ betsy/main
http://mirror.karneval.cz/pub/linux/linuxmint/packages/ betsy/upstream
http://repo.linrunner.de/debian/ jessie/main
http://repository.spotify.com/ stable/non-free
http://security.debian.org/ jessie/updates/contrib
http://security.debian.org/ jessie/updates/main
http://security.debian.org/ jessie/updates/non-free
http://www.deb-multimedia.org/ jessie/main
http://www.deb-multimedia.org/ jessie/non-free
/var/lib/dpkg/status
基本上是一样的。