How to Stop Ubuntu Linux from Automatically Installing Recommended Packages

The Problem with APT Recommends

When you use the apt or apt-get package manager to install software in Ubuntu Linux, the system does not just install the core package you requested. By default, Ubuntu’s package manager is configured to also automatically install “Recommended” packages. These are extra software components that the package maintainers believe you might find useful, such as supplementary documentation, optional plugins, or related GUI tools. On a graphical desktop, this is usually fine. However, if you are building a lean, headless server, or if you simply want absolute control over your system, this behaviour leads to severe software bloat and unnecessary disk usage.

How to Disable Recommended Packages Temporarily

If you only want to skip the recommended extras for a single installation command, you can use a specific command-line flag.

When running your install command, simply append the --no-install-recommends flag. For example:

sudo apt install apache2 --no-install-recommends

This tells APT to only install the absolute bare minimum dependencies required to make Apache run, ignoring all the optional extras.

How to Disable Recommended Packages Permanently

If you want to permanently change the default behaviour of APT so that you never have to type that long flag again, you must create an APT configuration file.

1. Open your terminal.

2. Create a new configuration file in the apt.conf.d directory using the nano text editor:

sudo nano /etc/apt/apt.conf.d/99norecommends

3. Paste the following two lines into the empty file:

APT::Install-Recommends "false";
APT::Install-Suggests "false";

4. Save the file and exit the editor (Press Ctrl+O, Enter, then Ctrl+X).

From this point forward, running a standard sudo apt install package-name will behave strictly, only pulling in the absolute hard dependencies required for the software to function, keeping your Ubuntu system clean and minimal.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.