user2350858
user2350858

Reputation: 741

Preseeding PhpMyAdmin - skip multiselect, skip password

I am trying to automate the PhpMyAdmin installation for a Ubuntu server running NGINX and i am having trouble skipping the reconfigure-webserver multiselect prompt:

Is there a reference for the possible options for each PhpMyAdmin install setting or options for a multiselect setting type?

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

This is the specific option i believe i am trying to figure out how to skip:

phpmyadmin phpmyadmin/reconfigure-webserver multiselect ?

Also how can i skip the app password so it is autogenerated?

I really appreciate any help, thank you!

Upvotes: 6

Views: 3820

Answers (2)

Danila Vershinin
Danila Vershinin

Reputation: 9855

To skip web servers selection, use:

echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect none" | debconf-set-selections

Upvotes: 2

Daniel
Daniel

Reputation: 4301

Here you have a script for a phpMyAdmin unattended install (run it as root).

For the random app password, I use pwgen; it is quite useful.

You will need to manually insert your mysql root password because the installer needs it in order to create the tables that phpMyAdmin uses to store its configuration.

I also added a line that moves the phpMyAdmin directory for security.

#!/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

Upvotes: 12

Related Questions