Answers:
使用debconf的配置预置。
执行测试安装以获取所需的值:
root@test1:~# apt-get install mysql-server
..并在安装过程中提示时设置root密码。
然后,您可以检查刚刚安装的内容的debconf设置是什么样(您可能需要安装debconf-utils
):
root@test1:~# debconf-get-selections | grep mysql-server
mysql-server-5.5 mysql-server/root_password_again password
mysql-server-5.5 mysql-server/root_password password
mysql-server-5.5 mysql-server/error_setting_password error
mysql-server-5.5 mysql-server-5.5/postrm_remove_databases boolean false
mysql-server-5.5 mysql-server-5.5/start_on_boot boolean true
mysql-server-5.5 mysql-server-5.5/nis_warning note
mysql-server-5.5 mysql-server-5.5/really_downgrade boolean false
mysql-server-5.5 mysql-server/password_mismatch error
mysql-server-5.5 mysql-server/no_upgrade_when_using_ndb error
那里有些杂音,但重要的是密码设置。
然后,对于全新安装,您可以通过预先设置密码来完全避免提示:
root@test2:~# echo "mysql-server-5.5 mysql-server/root_password_again password Som3Passw0rd" | debconf-set-selections
root@test2:~# echo "mysql-server-5.5 mysql-server/root_password password Som3Passw0rd" | debconf-set-selections
root@test2:~# apt-get install mysql-server
在安装过程中完全没有提示。
export DEBIAN_FRONTEND=noninteractive
apt-get -q -y install _packages_
debconf-set-selections
方法。
debconf软件包包含debconf-show
:
debconf-show package
sudo apt-get install debconf-utils
有必要的。