我正在通过复制和粘贴命令安装一堆应用程序apt-get
,但我想了解人们如何得出要安装哪些软件包的列表?例如,我正在安装“java8”。命令如下:
sudo apt-get install oracle-java8-installer
在哪里可以找到所有可用的“java”版本列表以供选择?其他应用程序呢?如何列出可以在特定 apt 存储库中安装的内容?
答案1
首先需要通过以下命令更新本地存储库缓存:
sudo apt-get update
现在假设您要搜索所有与 Java 相关的包。命令如下:
apt-cache search "java"
假设您想要安装vim
编辑器,并且通过安装apt-cache search vim
找到了您正在寻找的包,并且该包是vim-common
,现在您可以通过以下方式简单地安装该包的最新版本及其依赖项:
sudo apt-get install vim-common
就是这样。现在,如果您想检查是否有其他可用版本,vim-common
或者您愿意使用旧版本,那么您需要执行以下操作:
apt-cache showpkg vim-common
这将显示可用的版本以及依赖项。这是一个示例输出:
$apt-cache showpkg vim-common
Package: vim-common
Versions:
2:7.3.429-2ubuntu2.1 (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise-updates_main_binary-amd64_Packages) (/var/lib/dpkg/status)
Description Language:
File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise_main_binary-amd64_Packages
MD5: dc8579ec9ee0dc36b43d271645170c36
Description Language: en
File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise_main_i18n_Translation-en
MD5: dc8579ec9ee0dc36b43d271645170c36
2:7.3.429-2ubuntu2 (/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise_main_binary-amd64_Packages)
Description Language:
File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise_main_binary-amd64_Packages
MD5: dc8579ec9ee0dc36b43d271645170c36
Description Language: en
File: /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise_main_i18n_Translation-en
MD5: dc8579ec9ee0dc36b43d271645170c36
Reverse Depends:
vim-common:i386,vim-common
vim-nox,vim-common 2:7.3.429-2ubuntu2.1
vim-gtk,vim-common 2:7.3.429-2ubuntu2.1
vim-athena,vim-common 2:7.3.429-2ubuntu2.1
vim-tiny,vim-common 2:7.3.429-2ubuntu2.1
vim-gnome,vim-common 2:7.3.429-2ubuntu2.1
vim-dbg,vim-common 2:7.3.429-2ubuntu2.1
vim,vim-common 2:7.3.429-2ubuntu2.1
vim-common:i386,vim-common
vim-nox,vim-common 2:7.3.429-2ubuntu2
vim-latexsuite,vim-common 1:7.1.314
vim-gtk,vim-common 2:7.3.429-2ubuntu2
vim-athena,vim-common 2:7.3.429-2ubuntu2
vim-addon-manager,vim-common
vim-tiny,vim-common 2:7.3.429-2ubuntu2
vim-gnome,vim-common 2:7.3.429-2ubuntu2
vim-dbg,vim-common 2:7.3.429-2ubuntu2
vim,vim-common 2:7.3.429-2ubuntu2
Dependencies:
2:7.3.429-2ubuntu2.1 - libc6 (2 2.3.4) vim (16 (null)) vim-gnome (16 (null)) vim-gtk (16 (null)) vim-athena (16 (null)) vim-nox (16 (null)) vim-tiny (0 (null)) vim-common:i386 (0 (null))
2:7.3.429-2ubuntu2 - libc6 (2 2.3.4) vim (16 (null)) vim-gnome (16 (null)) vim-gtk (16 (null)) vim-athena (16 (null)) vim-nox (16 (null)) vim-tiny (0 (null)) vim-common:i386 (0 (null))
Provides:
2:7.3.429-2ubuntu2.1 -
2:7.3.429-2ubuntu2 -
Reverse Provides:
如您所见,有两个版本可用,一个是2:7.3.429-2ubuntu2.1
(最新的)另一个是2:7.3.429-2ubuntu2
(老的)。现在要安装旧版本,您需要发出以下命令:
sudo apt-get install vim-common=2:7.3.429-2ubuntu2