6

我正在尝试为运行 NGINX 的 Ubuntu 服务器自动安装 PhpMyAdmin,但在跳过 reconfigure-webserver 多选提示时遇到问题:

是否有每个 PhpMyAdmin 安装设置的可能选项或多选设置类型的选项的参考?

apt-get install phpmyadmin -y
debconf-get-selections | grep phpmyadmin

这是我相信我试图弄清楚如何跳过的特定选项:

phpmyadmin phpmyadmin/reconfigure-webserver multiselect ?

另外如何跳过应用程序密码以便自动生成?

我真的很感激任何帮助,谢谢!

4

2 回答 2

12

在这里,您有一个用于 phpMyAdmin 无人值守安装的脚本(以 root 身份运行)。

对于随机应用密码,我使用 pwgen;它非常有用。

您将需要手动插入您的 mysql root 密码,因为安装程序需要它来创建 phpMyAdmin 用来存储其配置的表。

我还添加了一行移动 phpMyAdmin 目录以确保安全。

#!/usr/bin/env bash

apt-get install pwgen -y

MYSQL_ROOT_PASS="my_sql_root_pass" # Put yours

PHPMYADMIN_DIR="pmasecret879"      # You don't want script kiddies playing  
                                   # with your default phpMyAdmin install.
AUTOGENERATED_PASS=`pwgen -c -1 20`

echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2" | debconf-set-selections
echo "phpmyadmin phpmyadmin/dbconfig-install boolean true" | debconf-set-selections
echo "phpmyadmin phpmyadmin/mysql/admin-user string root" | debconf-set-selections
echo "phpmyadmin phpmyadmin/mysql/admin-pass password $MYSQL_ROOT_PASS" | debconf-set-selections
echo "phpmyadmin phpmyadmin/mysql/app-pass password $AUTOGENERATED_PASS" |debconf-set-selections
echo "phpmyadmin phpmyadmin/app-password-confirm password $AUTOGENERATED_PASS" | debconf-set-selections

apt-get -y install phpmyadmin

# Regex FTW!
sed -i -r "s:(Alias /).*(/usr/share/phpmyadmin):\1$PHPMYADMIN_DIR \2:" /etc/phpmyadmin/apache.conf

php5enmod mcrypt # Needs to be activated manually (that's an issue for Ubuntu 14.04)

service apache2 reload
于 2014-05-30T06:37:11.340 回答
2

要跳过 Web 服务器选择,请使用:

echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect none" | debconf-set-selections
于 2016-01-02T19:51:39.490 回答