14

I am trying to install a bunch of .deb files without having to interact with them. MySQL Server for example will prompt for an interactive menu to enter an administrative password upon the dpkg's configuration.

I have tried.

export DEBIAN_FRONTEND=noninteractive && export DEBIAN_PRIORITY=critical && sudo /usr/bin/dpkg -i ./files/*

I am aware that I can just extract the files without configuration. I am trying to create a bash script to deploy a server pre-configured of default installation of Apache, php, mySQL etc. However, this "interactive installation" is causing issues.

Any ideas on how to disable it? or a work around?

Thanks

Steven Monday
  • 13,019
  • 4
  • 35
  • 45
james moore
  • 219
  • 1
  • 3
  • 7

3 Answers3

8

You are on the right track. You definitely want to use DEBIAN_FRONTEND=noninteractive. For critical questions that cannot be ignored, you will want to preseed the debconf database with the necessary answers. The debconf man page has all the details about how to accomplish that.

Steven Monday
  • 13,019
  • 4
  • 35
  • 45
5

For general noninteractive frontend, you may try:

sudo dpkg-reconfigure debconf -f noninteractive -p critical

To configure MySQL credentials, you may use server configuration file (e.g. ~/.my.cnf), like:

[client]
user=root
password=root

To select some specific selections, use debconf-set-selections, e.g.:

echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
kenorb
  • 5,943
  • 1
  • 44
  • 53
0

This should work:

$ pkgadd SOMEpkg << MYINPUT

y

some text

/usr/local

n

password

MYINPUT

I had to place blnk lines between the lines above or it formatted as one long line. In any case you can use the "script" command to save your input during complex installs, and then modify the output into a script to automate it for subsequent installations (man script).

kenorb
  • 5,943
  • 1
  • 44
  • 53