Truly non-interactive / unattended apt-get install
I’ve recently begun tinkering with Amazon Web Services (specifically their EC2 service) and RightScale. The major difference between these “Cloud” computing platforms and others is that the “instance” (i.e A running virtual machine) is temporary. Once it is shut down, all the data is gone. Additionally, the RightScale (and fairly common) way about going things is to use a “clean” machine image and script the install of the specific packages you need on Launch. So you can use the same image for an Application server, or DB server, or mail server – just have their respective packages installed on boot.
For Debian/Ubuntu (I happen to be using Ubuntu 8.10 Intrepid Ibex), you have the joy of apt-get. If you run apt-get with -q -y, it will assume “yes” to everything (and do it quietly). Now the only major problem is that some packages ask post install questions using whiptail (The blue configuration screen). In my case it it was MySQL demanding a root password. But I was informed of an easy way around that, exporting a value before install.
Below is an example of what to run:
# export DEBIAN_FRONTEND=noninteractive
# apt-get -q -y install mysql-server-5.0
This will install and start MySQL without so much as a peep until it is all done. Of course you get a blank root password which is a security issue, but that is easy to fix later. Piece of cake, if you happen to know about these magical exports.