Automation Install mysql server and postfix remotely

I am running a Python script with Fabric, which sent the bash script remotely and executed. The script should run on several remote servers automatically (without user intervention).

But when I install these 2 packages, the command line prompts a little difficulty inviting the GUI. This will cause the bash script to appear in standby mode, waiting for user input to continue.

  • mysql-server (user prompt for root password)
  • postfix (Request some configuration settings)

Is there an alternative to customizing the process without prompting the GUI on the command line?

+4
source share
1 answer

The http://www.muhuk.com/2010/05/how-to-install-mysql-with-fabric/ describes a solution for installing a mysql server, basically you need to do the following:

# password prompt while True: mysql_password = getpass('Please enter MySQL root password: ') mysql_password_confirmation = getpass('Please confirm your password: ') if mysql_password == mysql_password_confirmation: break else: print "Passwords don't match" # set the value in debconf with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True): if not run('dpkg-query --show mysql-server'): sudo('echo "mysql-server-5.1 mysql-server/root_password password ' '%s" | debconf-set-selections' % mysql_password) sudo('echo "mysql-server-5.1 mysql-server/root_password_again ' 'password %s" | debconf-set-selections' % mysql_password) 
+2
source

Source: https://habr.com/ru/post/1381742/


All Articles