The team that I put the web server:

aptitude update && aptitude upgrade && \ aptitude install apache2-mpm-itk nginx php5 libapache2-mod-php5 \ mysql-server mysql-client php5-mysql phpmyadmin 

During the installation, several confirmations and password entries are required:

  1. Confirmation (Y / N) Need Y
  2. Need to enter MySQL Root PASS
  3. Re-enter MySQL Root PASS
  4. A screen appears on which arrows select the installed web server (1 - Apache , 2 - lighttpd ). Need 1
  5. Confirm phpmyadmin auto configuration (Yes needed)
  6. Pass of database admin user
  7. Pass of database admin user - Retype
  8. Pass of database admin user - Retype

How to automate this using the Bash script. That the script itself is confirmed and entered?

  • one
    @Flasko, This is a question for the RutCode forum. debian has an automatic installation script. - zb '
  • and there are systems like [puppet] [1] [1]: puppetlabs.com - thunder
  • "there are unattended installation scripts in debian." can be more? And just using Bash in any way? - Flasko
  • Read about the expect . - avp pm
  • Yes, you can not do aptitude upgrade machine, i.e. possible, but the consequences are not predictable. You never know what it will ask. - zb '

1 answer 1

  1. yes / no answers can be obtained by passing the -y option:

     $ sudo aptitude -y ... $ sudo apt-get -y ... 
  2. configuration options can be set before installing packages. see options, for example, for the mysql-server-5.5 package (of course, after installation):

     $ sudo debconf-show mysql-server-5.5 * mysql-server/root_password_again: (password omitted) * mysql-server/root_password: (password omitted) mysql-server-5.5/postrm_remove_databases: false mysql-server/password_mismatch: mysql-server-5.5/start_on_boot: true mysql-server-5.5/nis_warning: mysql-server/no_upgrade_when_using_ndb: mysql-server-5.5/really_downgrade: false mysql-server/error_setting_password: 

    The configuration options for all installed packages can be viewed with the debconf-get-selections program from the debconf-utils package.

    for example, you can set the password and confirmation for the mysql-server-5.5 package as follows:

     $ echo 'mysql-server-5.5 mysql-server/root_password password ваш_пароль' | sudo debconf-set-selections $ echo 'mysql-server-5.5 mysql-server/root_password_again password ваш_пароль' | sudo debconf-set-selections 
  3. to completely disable any interactivity when running aptitude , apt-get , apt , dpkg , etc., you can use the environment variable DEBIAN_FRONTEND with a noninteractive value:

     $ sudo DEBIAN_FRONTEND=noninteractive aptitude install ...