7

How do I avoid installing the recommended packages and suggested packages along with upgrading the packages when I apt-get install a particular package?

1
  • Use apt-mark hold package-that-apt-should-leave-alone. hold hold is used to mark a package as held back, which will prevent the package from being automatically installed, upgraded or removed.
    – masterxilo
    Aug 14, 2022 at 12:08

2 Answers 2

8

Suggested packages are not installed by default, to install suggested packages you need to explicitly use --install-suggests option (or set APT::Install-Suggests yes apt configuration parameter).

Now, to avoid installing Recommended packages, either use --no-install-recommends option with apt-get or set APT::Install-Recommends "0" in anyplace referred by Dir::Etc::Main (typically /etc/apt/apt.conf) or Dir::Etc::Parts (typically /etc/apt/apt.conf.d/.

Similarly, to avoid upgrading packages, either use --no-upgrade option with apt-get or set APT::Get::Upgrade "0" in anyplace referred by Dir::Etc::Main or Dir::Etc::Parts.


In a nutshell, with apt-get:

sudo apt-get install --no-install-recommends --no-upgrade <package_name>
1
  • Is one - missing at the beginning of -no-install-recommends?
    – A.L
    Aug 11, 2017 at 18:51
2

In other to install a package without the recommended packages is to run the install command with the --no-install-recommends option like this:

sudo apt-get install --no-install-recommends package_name

Don't upgrade packages:

sudo apt-get install --no-upgrade pkg_name

Don't install new packages:

sudo apt-get install --only-upgrade pkg_name

--no-upgrade:

Do not upgrade packages; when used in conjunction with install, no-upgrade will prevent packages on the command line from being upgraded if they are already installed. Configuration Item: APT::Get::Upgrade.

--only-upgrade:

Do not install new packages; when used in conjunction with install, only-upgrade will install upgrades for already installed packages only and ignore requests to install new packages. Configuration Item: APT::Get::Only-Upgrade.

So to achieve what your asking:

sudo apt-get install --no-install-recommends --no-upgrade pkg_name

Source: man apt-get

1
  • Thanks ! but how about suggested ones and packages that will be upgraded? How do I avoid those?
    – samhitha
    Feb 27, 2017 at 4:47

Not the answer you're looking for? Browse other questions tagged .