“apt-get Upgrade sqlmap”正在升级所有软件包,而不仅仅是 sqlmap。这是预期的行为吗?

“apt-get Upgrade sqlmap”正在升级所有软件包,而不仅仅是 sqlmap。这是预期的行为吗?

我发出了以下命令,并结合了双与号,即“&&”。

apt-get update && apt-get upgrade sqlmap

显然所有已安装的软件包都在升级。这不是我的本意。我只是想升级一个名为“sqlmap”的包。为什么会有这种行为?

答案1

这是正确的行为。阅读文档 ( man apt-get):

       upgrade
           upgrade is used to install the newest versions of all packages
           currently installed on the system from the sources enumerated in
           /etc/apt/sources.list. Packages currently installed with new
           versions available are retrieved and upgraded; under no
           circumstances are currently installed packages removed, or packages
           not already installed retrieved and installed. New versions of
           currently installed packages that cannot be upgraded without
           changing the install status of another package will be left at
           their current version. An update must be performed first so that
           apt-get knows that new versions of packages are available.

答案2

您必须使用下一行仅更新一个包:

apt-get install --only-upgrade <packagename>

存在<packagename> sqlmap

答案3

如果您只想升级该软件包,请将后面的命令更改&&为:

apt-get install sqlmap

使用apt-get upgrade将尝试升级每个可以升级的包。

相关内容