Rackspace phpmyadmin install method ran with Apache

 Rackspace phpmyadmin install method ran with Apache

Centos Install Instructions:


First lets see if it's installed: 
Centos/Redhat: yum list installed |grep -i phpmyadmin

 
Check to see if phpmyadmin is in the current Repo's you have:

yum list |grep -i phpmyadmin

Note:CENTOS/REDHAT ONLY! 
If it is not in the Repo you will have to install Epel Repo which does have it in it's repository. 
Here are the instructions that will allow you install Epel Repository.  
https://support.rackspace.com/how-to/install-epel-and-additional-repositories-on-centos-and-red-hat/ 
 
 
 

Now we install phpmyadmin
yum  --disablerepo=* --enablerepo=epel install packagename
(Get it from your 'yum list |grep -i phpmyadmin' command)

Ubuntu Install:

apt-get install phpmyadmin


Configuration:

Lets start by creating a htpasswd Apache Authentication password file.
This will Create a dual Auth system into your phpmyadmin.
The first Auth user name will be serverinfo.
The second will be your database user/password.

Command to Run htpasswd user/pass creation:
htpasswd -c /etc/phpMyAdmin/phpmyadmin-htpasswd serverinfo

Htauth phpmyadmin User: serverinfo
Password: YOUR-PASSWORD

Stored username and password so we have it on file in /root/.phpmyadminpass:
echo "serverinfo YOUR-PASSWORD" > /root/.phpmyadminpass
chmod 640 /root/.phpmyadminpass



Create the vhost /etc/phpMyAdmin/apache.conf and insert the following configuration:

# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
   Order Deny,Allow
   Deny from All
   Allow from localhost 127.0.0.0/8 ::1

   AuthUserFile /etc/phpMyAdmin/phpmyadmin-htpasswd
   AuthName "Password protected"
   AuthType Basic
   Require valid-user

   # Allow password-less access for allowed IPs
   Satisfy any
</Directory>

<Directory /usr/share/phpMyAdmin/scripts/>
   Order Deny,Allow
   Deny from All
   Allow from localhost 127.0.0.0/8 ::1

   AuthUserFile /etc/phpMyAdmin/phpmyadmin-htpasswd
   AuthName "Password protected"
   AuthType Basic
   Require valid-user

   # Allow password-less access for allowed IPs
   Satisfy any
</Directory>

# This directory does not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#
#<IfModule mod_security.c>
# <Directory /usr/share/phpMyAdmin/>
# SecRuleInheritance Off
# </Directory>
#</IfModule>



Ensure  inside of /etc/phpMyAdmin/config.inc.php line with option 'auth_type' is set to cookie:
$cfg['Servers'][$i]['auth_type'] = 'cookie'; // Authentication method (config, http or cookie based)?

Link it to Apache conf.d vhost folder:
Centos/Redhat: ln -s /etc/phpMyAdmin/apache.conf /etc/httpd/conf.d/phpMyAdmin.conf
Ubuntu: ln -s /etc/phpMyAdmin/apache.conf /etc/apache2/conf-enabled/phpMyAdmin.conf

TEST


Test to ensure you are asked for two Authentications:
http://x.x.x.x/phpmyadmin/ (x replaced with your ip)
 

jim has written 83 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>