How to install packages with APT without user interaction?

Based on Daniel t's comment I was able to do this with DEBIAN_FRONTEND=noninteractive

DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -y -q --force-yes linux-image-2.6.32-5-amd64 

Beware that this answer I quote will not get rid of all dialogues, it will still display what APT/DPKG deems critical. Perhaps it's best to experiment with the second option + using the readline frontend for debconf and to prepare an answer file.

Quoting from a sister site:

This should do what you asked; asking the config questions afterward:

$ DEBIAN_PRIORITY=critical
$ export DEBIAN_PRIORITY
$ apt-get upgrade
# Wait a long time.   Should be almost entirely noninteractive.
$ dpkg-reconfigure --default-priority=medium --unseen-only

Alternatively you could try asking all the config questions before:

$ apt-get clean
$ cat >> /etc/apt/apt.conf <<EOF
// Pre-configure all packages before
// they are installed.
DPkg::Pre-Install-Pkgs {
    "dpkg-preconfigure --apt --priority=low";
};
EOF
$ apt-get upgrade