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?

Zanna
  • 70,465
samhitha
  • 167
  • 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 '22 at 12:08

2 Answers2

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>
heemayl
  • 91,753
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

George Udosen
  • 36,677