brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: --no-install-recommends stops apt from dragging in extras

Apt
~/tips/tip-ubuntu-apt-no-install-recommends

sudo apt install --no-install-recommends

Installs a package with only its required dependencies and skips the merely recommended ones.

Install one small tool on Ubuntu and sometimes apt wants thirty other packages. A lot of those are only recommended, not required.

You can tell apt to skip them:

sudo apt install --no-install-recommends 

The man page describes the option as keeping recommended packages from being treated as dependencies. What stays is the hard dependency chain, so the program installs and runs.

I would check first with a simulation. Add -s and apt prints what it would do without touching anything:

apt-get -s install 
apt-get -s install --no-install-recommends 

Compare the two lists. On a headless server or a minimal container the second one is often much shorter, which means less to patch later.

It is a habit I like for servers more than for desktops. A server should do one job, and every extra package is something else that needs patching.

The caveat: recommended means the maintainers thought most people want it. Fonts, documentation, plugins, sometimes a feature you assumed was built in. If something is missing afterwards, install it by name.

Further reading: apt-get(8) man page (Ubuntu 24.04), On this site: apt autoremove –purge also deletes the leftover config files, On this site: apt changelog shows why a package wants to update

More Apt tips sudo apt-mark minimize-manual apt list '~c' grep -E ' (install|upgrade|remove) ' /var/log/dpkg.log | tail -o Dpkg::Options::="–force-confold" upgrade sudo apt-get -d -y full-upgrade All Apt tips (42) All topics

Link