How do I install a .deb file silently and automatically?

OS: Debian 11

My goal is to install a .deb file silently and automatically from a bash script.

The command I am running inside a bash script is

sudo apt install -y ./*.deb

I get this screen

Yes, I can hit "Enter" on my keyboard, I can use the mouse to hit "OK" too. I don't want to.

What command do I run to auto-select "OK" when prompted so that everything is automatic?


Solution 1:

The message is shown via debconf, by the config script of the "zfs-dkms" package.

It's technically implemented not as a message but a debconf input dialog which gets a specific parameter, so you can avoid it by manually adding the parameter into debconf's database before installation:

echo zfs-dkms zfs-dkms/note-incompatible-licenses note true | debconf-set-selections

Solution 2:

After searching the internet, I stumbled upon an answer that works:

sudo DEBIAN_FRONTEND=noninteractive apt-get -y install ./*.deb