100

I use Ubuntu 12.04 64-bit, I did the following: sudo gedit /etc/apt/apt.conf and added

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

But it did not work. When I try to install a package, it still wants to install the suggested and recommended packages. How can I solve this?

2
  • 7
    apt-config dump |fgrep -i recommend will suggest current fashion syntax in case it changes again.
    – temoto
    Commented Feb 20, 2015 at 15:02
  • Use apt-mark hold package-that-apt-should-leave-alone. hold hold is used to mark a package as held back, which will prevent the package from being automatically installed, upgraded or removed.
    – masterxilo
    Commented Aug 14, 2022 at 12:08

8 Answers 8

127

If you do not want to install recomended packages:

  • for apt-get use --no-install-recommends and --no-install-suggests
  • for aptitude use --without-recommends or -R

If you want these flags to always be enabled (I do NOT recommend this) put the following lines in your /etc/apt/apt.conf file:

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

Remember that these packages are recommended for a reason and it is probably not a good idea to ignore it at all times. You would be better off using the flags in the cases where you know that the recommended packages are wrong.

2
  • 5
    Reading the packaging documentation I understand that 'recommended' packages should probably be installed. Can you explain why you don't recommend disabling the installation of 'suggested' packages? They seem rather annoying to me so far.
    – jlh
    Commented Feb 17, 2016 at 21:14
  • 4
    To add to this, the analogous command line flag to --no-install-recommends for suggested packages when running apt-get install ... is --no-install-suggests. Commented Jan 29, 2019 at 21:52
41

According to me, changing conf files are too risky and unnecessary. Rather apt-get provides options to specify do not install recommended packages.

sudo apt-get install --no-install-recommends package-name

This is better than changing conf file.

1
  • 1
    it is your machine. there's no problem with configuring it as you see fit
    – AER
    Commented May 21, 2023 at 14:48
34

The correct syntax in recent versions appears to be:

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

You can put this in /etc/apt/apt.conf (which no longer exists by default) or in a file such as 99local in /etc/apt/apt.conf.d.

Watch out for any other files in /etc/apt/apt.conf.d which may override your settings.

16

Checked today (07 Jan 2015).

These settings work well for me:

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

This solution does not work:

APT::Get::Install-Recommends "false";
APT::Get::Install-Suggests "false";
1
  • 3
    The question is about 12.04. The answer from lan already mentions for later versions it is APT::Install-Recommends so your answer does not add additional information.
    – Requist
    Commented Jan 7, 2015 at 19:43
5

You might be like me and have an /etc/apt/apt.conf.d/99synaptic file lurking around. I'm still not entirely sure where this file came from but it contains one line:

APT::Install-Recommends "true";

That would certainly have overridden a change in /etc/apt/apt.conf. I can't see that the file is used by any package any longer so I would suggest just deleting it (check the contents are similar) or swapping true for false.

3

You can specify configuration strings from the command line, using the -o option.

This works for me (APT v.1.4.8) (sudo as needed):

apt-get install package1 package2 -o APT::Install-Suggests=0 -o APT::Install-Recommends=0
1
  • 4
    This works for apt-get. But what should I do for apt?
    – Rolf
    Commented Feb 8, 2018 at 16:15
3

Use the following command to add it to /etc/apt/apt.conf.d/99norecommend:

apt-config dump | grep -we Recommends -e Suggests | sed s/1/0/ | sudo tee /etc/apt/apt.conf.d/99norecommend

Check the current settings by:

apt-config dump | grep -we Recommends -e Suggests

See: Can I make apt-get always use --no-install-recommends?

1
  • Small variation to this to handle true/false too: apt-config dump | grep -we Recommends -e Suggests | 's/1/0/;s/true/false/' | sudo tee /etc/apt/apt.conf.d/99norecommend Commented Sep 23, 2022 at 15:49
1

I would recommend creating /etc/apt/apt.conf.d/60user file with the single line:

APT::Install-Recommends "false";

This works fine for me on 12.04.

2
  • 3
    OP already stated that this did not work.
    – Oli
    Commented Oct 24, 2012 at 10:24
  • 1
    I checked this on 10.04, 12.04, 14.04 and APT::GET::* dont work, buy APT::Install-* did work well with "apt-get install"
    – ggrandes
    Commented Jul 11, 2014 at 9:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .