Linux no install recommends default

Linux package managers like Apt and DNF can be set to not install recommended packages by default, which can be useful for headless embedded systems or WSL. This can save 100s of MB or more, which can be important for embedded systems or WSL to save time and disk space. Saving of download/install time is often relevant to CI/CD systems. A caveat is that some expected features may be missing.

Apt

From the command line (without changing default):

apt install --no-install-recommends <package>

Create a file like “/etc/apt/apt.conf.d/95-no-install-recommends” with the following contents:

apt::install-recommends "false";

To override this setting at the command line, to install recommended packages add “–install-recommends” to the apt command line.

DNF

From the command line (without changing default):

dnf install --setopt=install_weak_deps=False <package>

Edit “/etc/dnf/dnf.conf” adding under [main]:

install_weak_deps=False