Install expect
and write an expect script that answers the prompts. This will look something like this (warning - not tested in any way):
#!/usr/bin/expect
spawn sudo apt install phpmyadmin
expect "server to reconfigure automatically"
set send_slow {1 0.5}
send -s " \r"
wait
This will run sudo apt install phpmyadmin
command, wait until a text server to reconfigure automatically
appears on the screen (if you need to provide a password to sudo
you should insert additional commands to handle this), then send two characters, space and Enter with 0.5 second delay between them, and finally wait until the command terminates.
Look here for more information about expect
:
https://www.slashroot.in/expect-command-tutorial-linux-example-usage
http://tcl.tk/man/expect5.31/expect.1.html
debconf-set-selections
- see for example How can I prevent apt-get/aptitude from showing dialogs during installation? and How can I install apt packages non-interactively? – steeldriver Apr 30 '23 at 23:59