1

I am trying to set up Apache/PHP/some other software in a Debian system via Shell commands.

Now, the command specified at http://www.howtoforge.com/perfect-server-debian-squeeze-with-bind-and-courier-ispconfig-3-p4 for installing Apache with some other software is this--

apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libruby libapache2-mod-ruby

Now, after running above command there are 2 prompts that appear on screen- at first prompt the question asked is

Web server to reconfigure automatically:

And I have to choose option as "Apache2"

The second question asked is

Configure database for phpmyadmin with dbconfig-common? 

for which I choose option as "No"

I want to create a simple shell script that I can run without needing to type in commands like the above one-- what I would like to know is, how do I specify in such a custom shell script, the options that I have to choose for these 2 questions (as shown above)? So that end user can simply run the script and he need not even answer the above 2 questions?

Arvind
  • 6,404
  • 20
  • 94
  • 143
  • 1
    You can find [this answer](http://stackoverflow.com/questions/6964712/how-to-do-unattended-install-of-websvn-with-apt-get) helpful – Kamil Šrot Nov 03 '12 at 08:06

1 Answers1

0

If you know order, number of prompts and correct answers you can try this:

echo -e "Apache2\nNo\n" | apt-get install apache2 apache2.2-common ...etc

where each line of echo will be redirected to corresponding input request from apt-get

adray
  • 1,408
  • 16
  • 20