Saturday, August 20, 2011

Step by Step Installation of LAMP on CentOS 5.6

1. Minimum Hardware Requirements.
OS:- CentOS 5.6
Memory:- 1 GB
Harddisk:- 15 GB


First change the hostname as server.domain.com
vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=server.domain.com
Change IP as
[root@client ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
HWADDR=08:00:27:E2:E4:CB
ONBOOT=yes
IPADDR=192.168.1.13
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.1
NM_CONTROLLED=yes

2.Installing MySQL 5.0
yum install mysql mysql-server mysql-devel

 MySQL starts automatically whenever the system boots
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

Set passwords for the MySQL root account:
mysql_secure_installation

[root@server ~]# mysql_secure_installation


First time password (leave blank)

Set root password? [Y/n] y

New password: <-- yourrootsqlpassword
Re-enter new password: 
<-- yourrootsqlpassword
Remove anonymous users? [Y/n] <-- ENTER
 ... Success!
Disallow root login remotely? [Y/n] <-- ENTER
 ... Success!
Remove test database and access to it? [Y/n] ßENTER
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reload privilege tables now? [Y/n] <-- ENTER
 ... Success!

3 Installing Apache2                                            
yum install httpd
chkconfig --levels 235 httpd on
/etc/init.d/httpd start
 browser  http://192.168.0.100, and we should see the Apache2 placeholder page:
Apache's default document root is /var/www/html
 configuration file is /etc/httpd/conf/httpd.conf.
Additional configurations are stored in the /etc/httpd/conf.d/ directory.

4.Installing PHP5
yum install php
etc/init.d/httpd restart
To confirm/testing PHP5

Document root of the default web site is /var/www/html.

We will now create a small PHP file (info.php) in that directory
[root@server ~]# vi /var/www/html/info.php
<?php
phpinfo();
?>
 we will call that file in a browser (e.g. http://192.168.1.13/info.php):

5Getting MySQL Support In PHP5
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
 http://192.168.0.100/info.php in your browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module:

phpMyAdmin

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -Uhv rpmforge-release-0.5.2-2.el5.rf.i386.rpm

yum install phpMyadmin
We change the Apache configuration so that phpMyAdmin allows connections not just from localhost (by commenting out the<Directory "/usr/share/phpmyadmin"> 
vi /etc/httpd/conf.d/phpmyadmin.conf
#
#  Web application to manage MySQL
#

#<Directory "/usr/share/phpmyadmin">
#  Order Deny,Allow
#  Deny from all
#  Allow from 127.0.0.1
#</Directory>

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


We will  change the authentication in phpMyAdmin from cookie to http:
vi /usr/share/phpmyadmin/config.inc.php
[...]
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
[...]

/etc/init.d/httpd restart---àTo restart apache
In the browser: http://192.168.1.13/phpmyadmin/:


No comments:

Post a Comment