From 2e806c1d5881cee82de1310191c93459917c623f Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Tue, 13 Aug 2013 16:35:58 +0530 Subject: [PATCH] Change phpMyAdmin Installation --- etc/nginx/common/locations.conf | 18 +-- usr/local/sbin/easyengine | 212 +++++++++++++++----------------- 2 files changed, 105 insertions(+), 125 deletions(-) diff --git a/etc/nginx/common/locations.conf b/etc/nginx/common/locations.conf index 8f248169..7bd3d817 100644 --- a/etc/nginx/common/locations.conf +++ b/etc/nginx/common/locations.conf @@ -21,30 +21,30 @@ location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif } # PMA Settings -location /phpmyadmin { - root /usr/share/; +location /pma { + root /var/www/; index index.php index.html index.htm; - location ~ ^/phpmyadmin/(.+\.php)$ { + location ~ ^/pma/(.+\.php)$ { try_files $uri =404; - root /usr/share/; + root /var/www/; fastcgi_pass php; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } - location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { - root /usr/share/; + location ~* ^/pma/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { + root /var/www/; } } location /phpMyAdmin { - rewrite ^/* /phpmyadmin last; + rewrite ^/* /pma last; } -location /pma { - rewrite ^/* /phpmyadmin last; +location /phpmyadmin { + rewrite ^/* /pma last; } # Status Pages diff --git a/usr/local/sbin/easyengine b/usr/local/sbin/easyengine index 1767bd26..356c0647 100755 --- a/usr/local/sbin/easyengine +++ b/usr/local/sbin/easyengine @@ -48,14 +48,6 @@ PHPREPO() || OwnError "Unable To Add PHP5 Launchpad Repository" } -PHPMYADMINREPO() -{ - # Add phpMyAdmin Launchpad Repository - echo -e "\033[34m Adding phpMyAdmin Launchpad Repository... \e[0m" - sudo add-apt-repository ppa:nijel/phpmyadmin \ - || OwnError "Unable To Add phpMyAdmin Launchpad Repository" -} - GPGKEY() { # Force GPG KEYS Check @@ -132,20 +124,49 @@ CHANGEPHPSOCKET() || OwnError "Unable To Change PHP Fastcgi Socket" } -INSTALLMYSQL() +WP-CLI() { - # Install MySQL - echo -e "\033[34m Installing MySQL... \e[0m" - sudo $EEAPTGET install mysql-server mysqltuner \ - || OwnError "Unable To Install MySQL" + # Install WP-CLI + if [ ! -d /usr/share/easyengine/wp-cli ] + then + echo -e "\033[31m WP Command Not Found ! \e[0m" + echo -e "\033[34m Installing WP-CLI, Please Wait... \e[0m" + curl http://wp-cli.org/installer.sh | INSTALL_DIR='/usr/share/easyengine/wp-cli' bash \ + || OwnError "Unable To Install WP-CLI" + + # Add WP Command In PATH Variable + ln -s /usr/share/easyengine/wp-cli/bin/wp /usr/bin/wp || OwnError "Unable To Create Symbolic Link For WP Command" + + # Add WP Auto Completion + cp -vi /usr/share/easyengine/wp-cli/vendor/wp-cli/wp-cli/utils/wp-completion.bash /etc/bash_completion.d/ + source /etc/bash_completion.d/wp-completion.bash + fi } INSTALLPMA() { - # Install PMA + # Install PMA/phpMyAdmin echo -e "\033[34m Installing PMA... \e[0m" - sudo $EEAPTGET install phpmyadmin \ - || OwnError "Unable To Install PMA" + + # Setup PMA/phpMyAdmin + mkdir -p /var/www/pma || OwnError "Unable To Create Directory: /var/www/pma" + + # Download PMA/phpMyAdmin + cd /var/www/pma || OwnError "Unable To Change Directory: /var/www/pma" + wget -c http://dl.cihar.com/phpMyAdmin/master/phpMyAdmin-master-latest.tar.gz \ + || OwnError "Unable To Download PMA" + + # Extract PMA/phpMyAdmin + tar --strip-components=1 -zxvf phpMyAdmin-master-latest.tar.gz -C /var/www/pma \ + || OwnError "Unable To Extract PMA" +} + +INSTALLMYSQL() +{ + # Install MySQL + echo -e "\033[34m Installing MySQL... \e[0m" + sudo $EEAPTGET install mysql-server mysqltuner \ + || OwnError "Unable To Install MySQL" } INSTALLPOSTFIX() @@ -161,27 +182,8 @@ INSTALLALL() echo -e "\033[34m Installing Nginx PHP5 MySQL Postfix... \e[0m" sudo $EEAPTGET install nginx-custom php5-common php5-mysqlnd php5-xmlrpc \ php5-cgi php5-curl php5-gd php5-cli php5-fpm php-apc php-pear \ - php5-dev php5-imap php5-mcrypt mysql-server mysqltuner phpmyadmin postfix \ - || OwnError "Unable To Install Nginx PHP5 MySQL PMA Postfix" -} - -WP-CLI() -{ - # Install WP-CLI - if [ ! -d /usr/share/easyengine/wp-cli ] - then - echo -e "\033[31m WP Command Not Found ! \e[0m" - echo -e "\033[34m Installing WP-CLI, Please Wait... \e[0m" - curl http://wp-cli.org/installer.sh | INSTALL_DIR='/usr/share/easyengine/wp-cli' bash \ - || OwnError "Unable To Install WP-CLI" - - # Add WP Command In PATH Variable - ln -s /usr/share/easyengine/wp-cli/bin/wp /usr/bin/wp || OwnError "Unable To Create Symbolic Link For WP Command" - - # Add WP Auto Completion - cp -vi /usr/share/easyengine/wp-cli/vendor/wp-cli/wp-cli/utils/wp-completion.bash /etc/bash_completion.d/ - source /etc/bash_completion.d/wp-completion.bash - fi + php5-dev php5-imap php5-mcrypt mysql-server mysqltuner postfix \ + || OwnError "Unable To Install Nginx PHP5 MySQL Postfix" } @@ -202,22 +204,29 @@ REMOVEPHP() php5-dev php5-imap php5-mcrypt || OwnError "Unable To Remove PHP5" } -REMOVEMYSQL() +REMOVEWPCLI() { - # Remove MySQL - echo -e "\033[34m Removing MySQL... \e[0m" - sudo $EEAPTGET remove mysql-server mysqltuner \ - || OwnError "Unable To Remove MySQL" + # Remove WP-CLI + echo -e "\033[34m Removing WP-CLI... \e[0m" + sudo rm -rf /var/www/wp-cli || OwnError "Unable To Remove WP-CLI" } REMOVEPMA() { - # Remove PMA - echo -e "\033[34m Installing PMA... \e[0m" - sudo $EEAPTGET remove phpmyadmin \ + # Remove PMA/phpMyAdmin + echo -e "\033[34m Removing PMA... \e[0m" + sudo rm -rf /var/www/pma \ || OwnError "Unable To Remove PMA" } +REMOVEMYSQL() +{ + # Remove MySQL + echo -e "\033[34m Removing MySQL... \e[0m" + sudo $EEAPTGET remove mysql-server mysqltuner \ + || OwnError "Unable To Remove MySQL" +} + REMOVEPOSTFIX() { # Remove Postfix @@ -231,15 +240,8 @@ REMOVEALL() echo -e "\033[34m Removing Nginx PHP5 MySQL Postfix... \e[0m" sudo $EEAPTGET remove nginx-custom php5-common php5-mysqlnd php5-xmlrpc \ php5-cgi php5-curl php5-gd php5-cli php5-fpm php-apc php-pear \ - php5-dev php5-imap php5-mcrypt mysql-server mysqltuner phpmyadmin postfix \ - || OwnError "Unable To Remove Nginx PHP5 MySQL PMA Postfix" -} - -REMOVEWPCLI() -{ - # Remove WP-CLI - echo -e "\033[34m Removing WP-CLI... \e[0m" - sudo rm -rf /var/www/wp-cli || OwnError "Unable To Remove WP-CLI" + php5-dev php5-imap php5-mcrypt mysql-server mysqltuner postfix \ + || OwnError "Unable To Remove Nginx PHP5 MySQL Postfix" } AUTOREMOVE() @@ -275,14 +277,6 @@ PURGEMYSQL() || OwnError "Unable To Purge MySQL" } -PURGEPMA() -{ - # Purge PMA - echo -e "\033[34m Installing PMA... \e[0m" - sudo $EEAPTGET purge phpmyadmin \ - || OwnError "Unable To Purge PMA" -} - PURGEPOSTFIX() { # Purge Postfix @@ -296,8 +290,8 @@ PURGEALL() echo -e "\033[34m Removing Nginx PHP5 MySQL Postfix... \e[0m" sudo $EEAPTGET purge nginx-custom php5-common php5-mysqlnd php5-xmlrpc \ php5-cgi php5-curl php5-gd php5-cli php5-fpm php-apc php-pear \ - php5-dev php5-imap php5-mcrypt mysql-server mysqltuner phpmyadmin postfix \ - || OwnError "Unable To Purge Nginx PHP5 MySQL PMA Postfix" + php5-dev php5-imap php5-mcrypt mysql-server mysqltuner postfix \ + || OwnError "Unable To Purge Nginx PHP5 MySQL Postfix" } @@ -790,43 +784,34 @@ then # Display Success Message echo -e "\033[34m PHP5 Successfully Installed \e[0m" - elif [ "$3" = "mysql" ] + elif [ "$3" = "pma" ] then - # Update The APT Cache - UPDATEAPT - - # Install MySQL - INSTALLMYSQL + # Install PMA + INSTALLPMA # Initialise Git - EEGITDIR=/etc/mysql/ + EEGITDIR=/var/www/pma/ EEGITINIT - + # Display Success Message - echo -e "\033[34m MySQL Successfully Installed \e[0m" + echo -e "\033[34m PMA Successfully Installed \e[0m" - elif [ "$3" = "pma" ] + elif [ "$3" = "mysql" ] then - # Install Python Software Properties - PYTHONSOFTWARE - - # Add phpMyAdmin Launchpad Repository - PHPMYADMINREPO - # Update The APT Cache UPDATEAPT - # Install PMA - INSTALLPMA + # Install MySQL + INSTALLMYSQL # Initialise Git - EEGITDIR=/etc/phpmyadmin/ + EEGITDIR=/etc/mysql/ EEGITINIT - + # Display Success Message - echo -e "\033[34m PMA Successfully Installed \e[0m" + echo -e "\033[34m MySQL Successfully Installed \e[0m" elif [ "$3" = "postfix" ] then @@ -856,16 +841,13 @@ then # Add PHP Launchpad Repository PHPREPO - # Add phpMyAdmin Launchpad Repository - PHPMYADMINREPO - # Fix GPG Key Problems GPGKEY # Update The APT Cache UPDATEAPT - # Install Nginx PHP5 MySQL PMA Postfix + # Install Nginx PHP5 MySQL Postfix INSTALLALL # Personal Settings For Nginx @@ -883,6 +865,9 @@ then # Install WP-CLI WP-CLI + # Install PMA/phpMyAdmin + INSTALLPMA + # Initialise Git EEGITDIR=/etc/nginx/ EEGITINIT @@ -896,7 +881,7 @@ then EEGITINIT # Initialise Git - EEGITDIR=/etc/phpmyadmin/ + EEGITDIR=/var/www/pma/ EEGITINIT # Initialise Git @@ -904,7 +889,7 @@ then EEGITINIT # Display Success Message - echo -e "\033[34m Nginx PHP5 MySQL PMA Postfix Successfully Installed \e[0m" + echo -e "\033[34m Nginx PHP5 PMA MySQL Postfix Successfully Installed \e[0m" fi @@ -938,29 +923,26 @@ then # Display Success Message echo -e "\033[34m PHP5 Successfully Removed \e[0m" - elif [ "$3" = "mysql" ] + elif [ "$3" = "pma" ] then - # Remove MySQL - REMOVEMYSQL - - # Remove Unwanted Packages - AUTOREMOVE + # Remove PMA + REMOVEPMA # Display Success Message - echo -e "\033[34m MySQL Successfully Removed \e[0m" + echo -e "\033[34m PMA Successfully Removed \e[0m" - elif [ "$3" = "pma" ] + elif [ "$3" = "mysql" ] then - # Remove PMA - REMOVEPMA + # Remove MySQL + REMOVEMYSQL # Remove Unwanted Packages AUTOREMOVE # Display Success Message - echo -e "\033[34m PMA Successfully Removed \e[0m" + echo -e "\033[34m MySQL Successfully Removed \e[0m" elif [ "$3" = "postfix" ] then @@ -983,9 +965,10 @@ then # Remove Unwanted Packages AUTOREMOVE REMOVEWPCLI - + REMOVEPMA + # Display Success Message - echo -e "\033[34m Nginx PHP5 MySQL PMA Postfix Successfully Removed \e[0m" + echo -e "\033[34m Nginx PHP5 PMA MySQL Postfix Successfully Removed \e[0m" fi @@ -1019,29 +1002,26 @@ then # Display Success Message echo -e "\033[34m PHP5 Successfully Purged \e[0m" - elif [ "$3" = "mysql" ] + elif [ "$3" = "pma" ] then - # Purge MySQL - PURGEMYSQL + # Purge PMA + REMOVEPMA - # Remove Unwanted Packages - AUTOREMOVE - # Display Success Message - echo -e "\033[34m MySQL Successfully Purged \e[0m" + echo -e "\033[34m PMA Successfully Purged \e[0m" - elif [ "$3" = "pma" ] + elif [ "$3" = "mysql" ] then - # Purge PMA - PURGEPMA + # Purge MySQL + PURGEMYSQL # Remove Unwanted Packages AUTOREMOVE # Display Success Message - echo -e "\033[34m PMA Successfully Purged \e[0m" + echo -e "\033[34m MySQL Successfully Purged \e[0m" elif [ "$3" = "postfix" ] then @@ -1066,7 +1046,7 @@ then AUTOREMOVE # Display Success Message - echo -e "\033[34m Nginx PHP5 MySQL PMA Postfix Successfully Purged \e[0m" + echo -e "\033[34m Nginx PHP5 PMA MySQL Postfix Successfully Purged \e[0m" fi