Thursday, October 29, 2009

how to install lamp and phpmyadmin 3.2.2.1 in centOS 5.3

After reffering some sites and blogs at last i got LAMP and phpmyadmin-3.2.2.1 installed correctly in my centos 5.3
If you want to install LAMP, first you need to install php and mysql .
To do this use the following commands in your terminal

#yum install php
#yum install php-gd
#yum install php-mbstring
#yum install mysql
#yum install mysql-server
#yum install php-mysql

The default version of php on  centOS5.3  is php-5.1, if you have to work with the phpmyadmin you need to upgrade it for 5.2 or higher version

Below command shows the existing php version
#php -v

To upgrade or install  5.3 version first install 5.1 by the above methods to get rid of php-mbcrypt problems and some errors. And i suggest you to install php 5.1 first and then follow the below steps.I found some repos on some sites it would fairly work for you also...

To install, first you must tell rpm to accept rpm’s sign

#rpm --import http://repo.webtatic.com/yum/RPM-GPG-KEY-webtatic-andy

Then add the yum repository information

#cd /etc/yum.repos.d/
#wget http://repo.webtatic.com/yum/webtatic.repo
 
 Install php
 
#yum --enablerepo=webtatic install php
 
And then install webserver apache
 
#yum install httpd
 
Now, start the Apache/httpd server
 
# /etc/init.d/httpd start
# chkconfig httpd on    (to run apache automatically when system runs)
 
After that test it in browser by typing http://localhost/
 
If we get apache welcome page webserver is installed correctly.
 
Now to  test php go to file system var/www/html
 

 
Create a file and name it as info.php and give permission to acess it i,e access i,e chmod 777 info.php (for testing)
Type the following lines in info.php
 

phpinfo();
?>
 
and save the file
 
Open your webbrowser and you can acess it by by typing http://localhost/info.php and you can find the version number in a blue screen and mysql details
 
And coming to mysql  first
 
#mysql
 
we get the following error as ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
 
To fix:

First start the mysql daemon, then type mysql

#/etc/init.d/mysqld start

#mysql
it comes in terminal as
>mysql

by default mysql has no password and To update mysql root password

mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';
mysql> FLUSH PRIVILEGES;

then to exit
mysql>exit;

To test it
#mysql -u root -p
#Enter password : new-password
it takes to mysql and exit from there

To install phpmyadmin

#cd /var/www/html

If not avial able the below link as phpmyadmin go to link http://sourceforge.net/projects/phpmyadmin/files/ and browse the version you want and download.

#wget http://nchc.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-3.2.2.1-english.tar.gz
#tar zxvf phpMyAdmin-3.2.4-english.tar.gz
#mv phpMyAdmin-3.2.4-english phpmyadmin
#cd phpmyadmin
#cp config.sample.inc.php config.inc.php

Edit config.inc.php file


#nano config.inc.php    and go to line and modify if you wish you can keep blowfish secret also

$cfg['Servers'][$i]['auth_type'] = ‘http‘; # default is cookies

Restart your apache webserver for updating the setting

# /etc/init.d/httpd restart
# /etc/init.d/mysqld restart

To keep always apache on when system is rebooted

#chkconfig httpd on
#chkconfig mysqld on

You can test  phpmyadmin by http://localhost/phpmyadmin

Give the user name as root and passord  (new-password) in popup

Hope that all works fine..

1 comment:

  1. Hi Ugesh...found your purse..please call me @9032302797

    ReplyDelete