apt-get更新/升级列表,而不会改变任何东西

我想查看哪些软件包可用于更新/升级而不实际更改任何文件,因为有一些软件包,我不想更新。 那么是否可以通过exception来进行更新?

从apt-get手册页,

-s, --simulate, --just-print, --dry-run, --recon, --no-act No action; perform a simulation of events that would occur but do not actually change the system. Configuration Item: APT::Get::Simulate. Simulation run as user will deactivate locking (Debug::NoLocking) automatic. Also a notice will be displayed indicating that this is only a simulation, if the option APT::Get::Show-User-Simulation-Note is set (Default: true). Neither NoLocking nor the notice will be triggered if run as root (root should know what he is doing without further warnings by apt-get). Simulate prints out a series of lines each one representing a dpkg operation, Configure (Conf), Remove (Remv), Unpack (Inst). Square brackets indicate broken packages and empty set of square brackets meaning breaks that are of no consequence (rare). 

所以只要确保你apt-get -s upgrade

如果你想升级某些软件包,只需apt-get install <package name> ,如果它已经安装,它将会更新它。 然而,它也将不得不更新所有的依赖关系,并且依赖于它们可以级​​联到很多更新中。

如果我在包更新后面,我会在一些大的(也许是PHP,apache2等)上进行apt-get install ,这样我就可以保留它们并检查所有问题,然后apt-get upgrade完成后。

要列出要用其版本升级的软件包:

 $ sudo apt-get -u -V upgrade Reading package lists... Done Building dependency tree Reading state information... Done The following packages have been kept back: mysql-client-5.5 (5.5.29-0ubuntu0.12.04.2 => 5.5.32-0ubuntu0.12.04.1) mysql-server-5.5 (5.5.29-0ubuntu0.12.04.2 => 5.5.32-0ubuntu0.12.04.1) mysql-server-core-5.5 (5.5.29-0ubuntu0.12.04.2 => 5.5.32-0ubuntu0.12.04.1) 0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded. 

然后,您可以select要升级的内容:

 $ sudo apt-get --only-upgrade install mysql-client-5.5 Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: firefox-globalmenu Use 'apt-get autoremove' to remove them. The following extra packages will be installed: libterm-readkey-perl The following NEW packages will be installed: libterm-readkey-perl The following packages will be upgraded: mysql-client-5.5 1 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 8,123 kB of archives. After this operation, 139 kB of additional disk space will be used. Do you want to continue [Y/n]? Y Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/main libterm-readkey-perl i386 2.30-4build3 [28.4 kB] Get:2 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main mysql-client-5.5 i386 5.5.32-0ubuntu0.12.04.1 [8,094 kB] ... 

如果删除了任何旧的依赖关系,则可以运行apt-get autoremove ,正如您所见,将会提示安装任何新的依赖关系。 --only-upgrade标志不是必须的,但是如果你想要确保你不会意外地安装一个新的软件包,而不是升级一个已经存在的软件包,也就是说你有这样一个时刻,并且意外地input了错误的软件包:

 $ sudo apt-get --only-upgrade install mysql-proxy Reading package lists... Done Building dependency tree Reading state information... Done Skipping mysql-proxy, it is not installed and only upgrades are requested. The following package was automatically installed and is no longer required: firefox-globalmenu Use 'apt-get autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded. 

它是否可以帮助您发出只进行模拟的apt-get -s upgrade ? 然后你可以用apt-get install <thepackage>更新每个想要的包。

如果你想用一个漂亮的CLI GUI进行交互,那么使用aptitude 。 如果尚未安装,请使用apt-get install aptitude