9

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

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

4

2 回答 2

15

运行为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

于 2016-01-12T13:27:12.693 回答
12

为了在脚本中安装 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

于 2015-06-09T19:51:47.353 回答