我正在尝试为运行NGINX的Ubuntu服务器自动安装PhpMyAdmin,而我在跳过重新配置 - 网络服务器多选提示时遇到问题:
是否有针对每个PhpMyAdmin安装设置的可能选项的参考或多选设置类型的选项?
apt-get install phpmyadmin -y
debconf-get-selections | grep phpmyadmin
这是具体的选择我相信我想弄清楚如何跳过:
phpmyadmin phpmyadmin/reconfigure-webserver multiselect ?
另外,如何跳过应用密码以便自动生成?
我非常感谢任何帮助,谢谢!
答案 0 :(得分:10)
这里有一个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
答案 1 :(得分:2)
要跳过Web服务器选择,请使用:
echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect none" | debconf-set-selections