想要从bash脚本安装PHPmyadmin,我发现很难获得正确的debconf选择,以便不安装/配置任何Web服务器(使用Nginx,只有apache2和lighttpd可用)并且没有配置dbconfig-的PHPmyadmin数据库很常见,因为我在谷歌上没有找到这样的东西.
这是在Ubuntu 14.04 PHPmyadmin 4:4.0.10-1上使用debconf选择的完整列表:
debconf-get-selections | grep PHPmyadmin PHPmyadmin PHPmyadmin/password-confirm password # MysqL application password for PHPmyadmin: PHPmyadmin PHPmyadmin/MysqL/app-pass password PHPmyadmin PHPmyadmin/MysqL/admin-pass password PHPmyadmin PHPmyadmin/setup-password password PHPmyadmin PHPmyadmin/app-password-confirm password # Database type to be used by PHPmyadmin: PHPmyadmin PHPmyadmin/database-type select MysqL # Reinstall database for PHPmyadmin? PHPmyadmin PHPmyadmin/dbconfig-reinstall boolean false PHPmyadmin PHPmyadmin/remove-error select abort PHPmyadmin PHPmyadmin/reconfigure-webserver multiselect PHPmyadmin PHPmyadmin/missing-db-package-error select abort # Configure database for PHPmyadmin with dbconfig-common? PHPmyadmin PHPmyadmin/dbconfig-install boolean false PHPmyadmin PHPmyadmin/upgrade-error select abort # Perform upgrade on database for PHPmyadmin with dbconfig-common? PHPmyadmin PHPmyadmin/dbconfig-upgrade boolean true # Deconfigure database for PHPmyadmin with dbconfig-common? PHPmyadmin PHPmyadmin/dbconfig-remove boolean PHPmyadmin PHPmyadmin/remote/port string PHPmyadmin PHPmyadmin/internal/skip-preseed boolean true # Do you want to back up the database for PHPmyadmin before upgrading? PHPmyadmin PHPmyadmin/upgrade-backup boolean true PHPmyadmin PHPmyadmin/setup-username string admin # Host name of the MysqL database server for PHPmyadmin: PHPmyadmin PHPmyadmin/remote/host select # MysqL database name for PHPmyadmin: PHPmyadmin PHPmyadmin/db/dbname string PHPmyadmin PHPmyadmin/MysqL/admin-user string root PHPmyadmin PHPmyadmin/install-error select abort # Host running the MysqL server for PHPmyadmin: PHPmyadmin PHPmyadmin/remote/newhost string # MysqL username for PHPmyadmin: PHPmyadmin PHPmyadmin/db/app-user string # Connection method for MysqL database of PHPmyadmin: PHPmyadmin PHPmyadmin/MysqL/method select unix socket PHPmyadmin PHPmyadmin/internal/reconfiguring boolean false # Do you want to purge the database for PHPmyadmin? PHPmyadmin PHPmyadmin/purge boolean false PHPmyadmin PHPmyadmin/passwords-do-not-match error
注意:为了运行debconf-get-selections你需要debconf-utils包(在Ubuntu / Debian上可能和其他Debian基础发行版一样),运行apt-get install debconf-utils(安装时没有提示)那些将通过脚本完成此任务的人).
以root身份运行:
APP_PASS="your-app-pwd" ROOT_PASS="your-admin-db-pwd" APP_DB_PASS="your-app-db-pwd" echo "PHPmyadmin PHPmyadmin/dbconfig-install boolean true" | debconf-set-selections echo "PHPmyadmin PHPmyadmin/app-password-confirm password $APP_PASS" | debconf-set-selections echo "PHPmyadmin PHPmyadmin/MysqL/admin-pass password $ROOT_PASS" | debconf-set-selections echo "PHPmyadmin PHPmyadmin/MysqL/app-pass password $APP_DB_PASS" | debconf-set-selections echo "PHPmyadmin PHPmyadmin/reconfigure-webserver multiselect apache2" | debconf-set-selections apt-get install -y PHPmyadmin
来自:http://gercogandia.blogspot.com.ar/2012/11/automatic-unattended-install-of.html