Tuesday, August 03, 2010

Install LAMP on Server CentOS 5.5

      LAMP is an acronym for a solution stack of free, open source software, originally coined from the first letters of Linux (operating system), Apache HTTP Server, MySQL (database software), and PHP, principal components to build a viable general purpose web server.

1. Install MySQL
# yum install mysql mysql-server
Adding MySQL to startup
# chkconfig --levels 235 mysqld on
# /etc/init.d/mysqld start
Create MySQLadmin User and Password
# mysqladmin -u root password YourPassSQL
# mysqladmin -h HostNameServer -u root password YourPassSQL
You can find HostNameServer on terminal console  [root@HostNameServer ~]#


2. Install Apache.
# yum -y install httpd
Adding Apache to startup, so it can automatic loaded if system restarted.
# chkconfig --levels 235 httpd on
# service httpd start
To check Apache has installed on server go to http://YourIPAddress/ and if you see as in the screenshoot that means Apache has been installed on your server.

If you get message "No Route To Host" that means you must open port 80 that still closed by firewall.
To open port 80 simply do this step:
# vi /etc/sysconfig/iptables
Add this command and save (to save press key "Esc" and then type ":wq")
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 80 -j ACCEPT
And then restart IPTABLES
# service iptables restart


3. Install PHP
# yum install php php-mysql php-mbstring php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
Restart Apache
# service httpd restart
To check php has been installed on server simply do following step:
# vi /var/www/http/php/index.php
and type following php code:
<?php
phpinfo();
?>
Save and go to http://YourIPAddress/php 
if php has been installed on your server, you will see a page like this:


DONE!!!
Now you can build a website on your server.

No comments:

Post a Comment