没有安装webserver且没有dbconfig-common的phpmyadmin无人参与安装的debconf选择

时间:2015-06-09 19:51:47

标签: debian debconf

想要从bash脚本安装phpmyadmin,我发现很难获得正确的debconf选择,以便不安装/配置任何Web服务器(使用nginx,只有apache2和lighttpd可用)并且没有配置phpmyadmin数据库使用dbconfig-common,因为我在Google上没有找到这样的内容。

这是在Ubuntu 14.04上使用debconf选择的完整列表phpmyadmin 4:4.0.10-1:

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(没有提示安装那些将通过脚本执行此操作的人。)

2 个答案:

答案 0 :(得分:12)

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

答案 1 :(得分:11)

为了在脚本(无人值守安装)中安装phpmyadmin而不安装/配置任何Web服务器或者使用dbconfig-common配置phpmyadmin数据库,您需要在安装软件包之前配置以下选项

phpmyadmin phpmyadmin/internal/skip-preseed boolean true
phpmyadmin phpmyadmin/reconfigure-webserver multiselect
phpmyadmin phpmyadmin/dbconfig-install boolean false

如果没有phpmyadmin phpmyadmin/internal/skip-preseed boolean true,它将开始使用dbconfig-common配置数据库(无论phpmyadmin phpmyadmin/dbconfig-install如何设置)。对我而言,这是我所遗漏的,而我在Google上找不到。其余的都很明显。

您可以这样设置:

debconf-set-selections <<< "phpmyadmin phpmyadmin/internal/skip-preseed boolean true"
debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect"
debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean false"

或者如果这不起作用:

echo "phpmyadmin phpmyadmin/internal/skip-preseed boolean true" | debconf-set-selections
echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect" | debconf-set-selections
echo "phpmyadmin phpmyadmin/dbconfig-install boolean false" | debconf-set-selections

然后运行apt-get -y install phpmyadmin