-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpma.sh
25 lines (17 loc) · 1.07 KB
/
pma.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env bash
apt-get install pwgen -y
MYSQL_ROOT_PASS="MYPASSWORD123" # 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