add

Thursday, April 26, 2012

Install phpMyAdmin on CentOs

while installing phpmyadmin on my local machine using vmware at Centos 5.5.
i faced some problems so thought to share the steps for other to overcome these problems.
1. Update the packages
# yum update -y

2. Install MySQL packages
# yum install mysql-server mysql mysql-devel
3. Make MySQL boot up automatically
# chkconfig mysqld on
4. Start MySQL service
# service mysqld start
# /etc/init.d/mysqld restart
5. Set the password for the root user
# /usr/bin/mysql_secure_installation (Recommended)
OR
# mysqladmin -u root password eaziweb
6. Install php and common packages
# yum install php php-gd php-imap php-mysql php-pear php-xml phpxmlrpc curl libxml2 php-mbstring php-mcrypt
7. Install phpMyAdmin
Because the version of php on CentOS 5.5 is 5.1.6, we only can install phpMyAdmin 2.x, I choose 2.11.11.3.
# cd /usr/share
# wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/2.11.11.3/phpMyAdmin-2.11.11.3-english.tar.gz/download
# tar xvfz phpMyAdmin-2.11.11.3-english.tar.gz
# mv phpMyAdmin-2.11.11.3-english phpmyadmin
# rm phpMyAdmin-2.11.11.3-english.tar.gz
# cd phpmyadmin
# cp config.sample.inc.php config.inc.php
8. Edit the config.inc.php file, find the line that contain “blowfish_secret”, and modify like below.
$cfg['blowfish_secret'] = ‘TypeAnything_for_Secure’;
9. Restart the httpd service
# /etc/init.d/httpd restart
10. Enter the URL http://[IP Address]/phpMyAdmin/ on Firefox browser, we’ll can see the login web page.
http://localhost/phpMyAdmin
After inputting the root user and its password(eaziweb), we can use phpMyAdmin to manage the MySQL.
Errors
1. 404 Not Found Error
Please make sure you push your phpMyAdmin directory in your webroot. In my case it’s /var/www/html
cp -r phpMyAdmin/ /var/www/html/
2. 403 Forbidden Error
I spend good amount of time finding why access is forbidden and finally did following setting
2.1 Go to /etc/httpd/conf.d/
2.2 vi phpMyAdmin.conf
2.3 Add following lines

Order allow,deny
Options Indexes
Allow from all
Still not able to access, try disabling the SElinux
SElinux is extra security layer in Linux and sometimes it provide conflicts for apache to work
vi /etc/selinux/config
Modify SELINUX=enforcing  to SELINUX=disabled  //Discuss with your senior. Mine is test server.
Restart your machine
hit http://localhost/phpMyAdmin prompt for username/password for mysql login 

Please note all the steps executed via root credentials . You can use su command to login as root and carry the same steps.

1 comment:

  1. These facts are really interesting. Few of them were well known for me but many of them were brand new for me too!
    I will print this one out and show to my friends because they will be definitely interested in that. Thanks!
    phpMyAdmin

    ReplyDelete