Sunday 21 November 2010

How to tell aptitude to ignore recommended packages in Linux

Ubuntu (and Debian) Linux will, by default, add "recommended" / "suggested" packages to some installs. If you are short of storage space, this can be a problem. Here, I present 2 ways, one persistent, one temporary, to prevent these extra packages being installed.


The persistent way
Create or Edit the file /etc/apt/apt.conf file and add the following contents to it:


// Recommends are as of now still abused in many packages
APT::Install-Recommends "0";
APT::Install-Suggests "0";



This will apply to ALL package installs.


The temporary way
Alternatively, if you would prefer to normally install recommended packeages, but ignore them in one case, you can simply add a flag to the command line. Eg:


sudo aptitude install <package> becomes


sudo aptitude install --without-recommends <package>


Note, you can have this set up the opposite way. To do this, make the changes above under "The persistent way". Then, when you want to install a package WITH all the recommended/suggested additional packages, simply add a --with-recommends flag to the command (the flag overrides the apt.conf file).

No comments: