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

I'm trying to create a minimalist debian install for my netbook. I have a clonezilla restore point that I made right after a fresh minimal debian install.

I do not have any packages other than what debian installs automatically during a minimal install. I deselected everything in taskel (no desktop environment, nothing).

I want to install some packages. Since I am creating a minimalist install, I want to always use sudo apt-get --no-install-recommends <package-name>.

Is there a way that I can create like a custom abbreviated command for this? Or is there a way that I could copy and paste a bunch of those commands into a text document and then run them all sequentially using one command? Do you know of a simpler, more elegant way to accomplish running a bunch of packages installs from a freshly installed minimal command prompt?


Solution 1:

You can configure apt via apt.conf files.

Here is a command I use on my server (as root):

cat > /etc/apt/apt.conf.d/01norecommend << EOF
APT::Install-Recommends "0";
APT::Install-Suggests "0";
EOF

To see if apt reads this, enter this in command line (as root or regular user):

apt-config dump | grep Recommends

Solution 2:

Here is a one-liner to create /etc/apt/apt.conf.d/999norecommend file as per @esplor's answer:

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