在这里,您有一个用于 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