27 февраля 2013 г.

Install PhpMyAdmin 3.5.5 for Apache or Nginx on RHEL/CentOS 6.3/5.9 Fedora 18-12

Step 1: Install Required Repositories for PhpMyAdmin 3.5.5

First, install dependency packages using following repositories.
[For RHEL/CentOS 6.3/5.9 - 32 Bit OS]
## Epel Dependency on RHEL/CentOS 6 ##
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

## Remi Dependency on RHEL/CentOS 6 ##
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

## Epel Dependency on RHEL/CentOS 5 ##
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

## Remi Dependency on RHEL/CentOS 5 ##
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
[For RHEL/CentOS 6.3/5.9 - 64 Bit OS]
## Epel Dependency on RHEL/CentOS 6 ##
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

## Remi Dependency on RHEL/CentOS 6 ##
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

## Epel Dependency on RHEL/CentOS 5 ##
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

## Remi Dependency on RHEL/CentOS 5 ##
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
[For Fedora 18-12]
## Remi Dependency on Fedora 18,17,16,15,14,13,12 ##
# rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm 
# rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

## Remi Dependency on Fedora 18 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-18.rpm

## Remi Dependency on Fedora 17 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-17.rpm

## Remi Dependency on Fedora 16 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-16.rpm

## Remi Dependency on Fedora 15 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-15.rpm

## Remi Dependency on Fedora 14 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-14.rpm

## Remi Dependency on Fedora 13 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-13.rpm

## Remi Dependency on Fedora 12 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-12.rpm

Step 2: Install PhpMyAdmin 3.5.5

Once you’ve installed above repositories, you can run the following command to install it.
# yum --enablerepo=remi install phpmyadmin
Note : If your are using PHP 5.4 on RHEL/CentOS systems, then you need to run the below command to install it.
# yum --enablerepo=remi,remi-test install phpmyadmin

Step 3: Configuring PhpMyAdmin 3.5.5 for Apache or Nginx

[For Apache]
In Apache you don’t need to setup any Virtual Host for phpMyAdmin, because you will get working phpMyAdmin automatically. The main configuration file is located under /etc/httpd/conf.d/phpMyAdmin.conf.
[For Nginx]
For Nginx you need to setup and create Virtual Host file manually by creating following file.
# vi etc/nginx/sites-available/phpMyAdmin
Add the following whole code to it, save and exit. In the below configuration file, I have chosen server name as tecmint, you could change it to any as per your choice.
server {
       listen   80;
       server_name tecmint;
       access_log /var/log/nginx/phpmyadmin/access.log;
       error_log /var/log/nginx/phpmyadmin/error.log;
       root /usr/share/phpMyAdmin;

       location / {
           index  index.php;
       }

       ## Images and static content is treated different
       location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
           access_log        off;
           expires           360d;
       }

       location ~ /\.ht {
           deny  all;
       }

       location ~ /(libraries|setup/frames|setup/libs) {
           deny all;
           return 404;
       }

       location ~ \.php$ {
           include /etc/nginx/fastcgi_params;
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin$fastcgi_script_name;
       }
}
Now set server name tecmint to localhost, To do this, just add the following entry in your /etc/hosts file.
127.0.0.1  tecmint
Now create required directory and enable Nginx virtual host for phpmyadmin.
# mkdir -p /var/log/nginx/phpmyadmin
# cd /etc/nginx/sites-enabled
# ln -s /etc/nginx/sites-available/phpMyAdmin

Step 4: Restarting Apache or Nginx Service

Once you all set, now restart the service based on your selected web server.
[Restart Apache]
# /etc/init.d/httpd restart
OR
# service httpd restart
[Restart Nginx]
# /etc/init.d/nginx restart
OR
# service nginx restart

Step 5: Starting PhpMyAdmin 3.5.5

[Start PhpMyAdmin 3.5.5 on Apache]
Open your browser and type the URL as http://localhost/phpmyadmin.
PhpMyAdmin Welcome Screen in Apache
PhpMyAdmin Welcome Screen in Apache
[Start PhpMyAdmin 3.5.5 on Nginx]
Open your browser and type the URL as http://tecmint.
PhpMyAdmin Welcome Screen in Nginx
PhpMyAdmin Welcome Screen in Nginx