Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preseeding PhpMyAdmin - skip multiselect, skip password

Tags:

ubuntu

debconf

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!

like image 990
user2350858 Avatar asked Mar 16 '14 17:03

user2350858


1 Answers

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
like image 73
Daniel Avatar answered Oct 03 '22 01:10

Daniel