In this post, we will know how to do non-interactive apt install in Debian Operating System.
By this method you can skip the interactive query ask while doing apt or apt-get install command.
For example, when we run apt-get -y install nagios-nrpe-server
, the samba and dhcp packages also get installed and at that time on terminal it requires user confirmation to proceed by typing ‘yes|no|ok’
Set non-interactive mode in apt / apt-get command
Set the environment variable called DEBIAN_FRONTEND=noninteractive
on terminal in runtime.
When you are login to local system, you can directly provide the given below command.
sudo export DEBIAN_FRONTEND=noninteractive
# Test now
sudo apt install -y <package-name>
When you are login to remote machine via SSH then in that case declare the Environment in SSH command itself.
sudo ssh hostname "export DEBIAN_FRONTEND=noninteractive;apt-get -q -y <package-name>"