Saturday, June 23, 2012

Save disk space with apt-get option "no-install-recommends" in Xubuntu

Every package in Ubuntu has a set required packages, a set of recommended packages and a set of suggested packages. The required packages are dependencies, so their installation is mandatory, but the installation of other two sets can be skipped. The recommended and suggested packages are not essential to the functioning of the package being installed. Disabling the installation of recommendations allows to save a lot of disk space.

Example 1: recommendations enabled
$ sudo apt-get install texworks
...
The following extra packages will be installed:
  lmodern luatex texlive-base texlive-binaries texlive-common texlive-doc-base
  texlive-latex-base texlive-latex-base-doc texlive-luatex texworks-help-en
Suggested packages:
  perl-tk texlive-xetex texworks-scripting-lua texworks-scripting-python
The following NEW packages will be installed:
  lmodern luatex texlive-base texlive-binaries texlive-common texlive-doc-base
  texlive-latex-base texlive-latex-base-doc texlive-luatex texworks
  texworks-help-en
0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
Need to get 91.6 MB of archives.
After this operation, 174 MB of additional disk space will be used.
Do you want to continue [Y/n]? 
Example 2: recommendations disabled
$ sudo apt-get install texworks
...
Suggested packages:
  texlive-xetex texworks-scripting-lua texworks-scripting-python
Recommended packages:
  texlive-latex-base texworks-help-en
The following NEW packages will be installed:
  texworks
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,360 kB of archives.
After this operation, 3,617 kB of additional disk space will be used.
Do you want to continue [Y/n]?

This is a great example of the amount of disk space that can be saved: 4MB against 174MB.

Disable automatic recommendations

  1. Disable recommendations temporally (for single package installation), adding the --no-install-recommends option:

    sudo apt-get install package --no-install-recommends
    
  2. Disable recommendations permanently, using apt.conf file:

    echo -e 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' | sudo tee /etc/apt/apt.conf
    

Alternatively, Synaptic (available at Applications Menu > Settings > Synaptic Package Manager) can be used to disable automatic installation of recommend packages. Just access Settings > Preferences > General and uncheck "Consider recommended packages as dependencies".

Using synaptic to disable automatic installation of recommended packages.

References

Tip: Tell apt-get not to install “recommends” packages in Debian Linux

2 comments:

  1. Good article as usually :)

    Graphically, you can apply the option permanently in the preferences of Synaptic.

    ReplyDelete
    Replies
    1. Thank you for your kind words and also for the suggestion. The post was updated to include the graphical alternative.

      Delete