Breaking

How To Install Linux, Apache, MySQL, PHP (LAMP) On CentOS 6






This tutorial describes how to install and configure Linux, Apache, MySQL, PHP (LAMP) On CentOS 6




LAMP is an opensource web service stacks, consist of four components:  the Linux operating system, the Apache HTTP Server, the MySQL relational database management system (RDBMS), and the PHP programming language.



Step 1: Install Apache webserver

To install Apache webserver in your server, Open terminal and type following command.

# yum install httpd



Start your Apache service by following command

# service httpd start


Note:
/var/www/html is apache default directory. Apache configuration file is under /etc/httpd/conf/httpd.conf and default port is 80.
We can test our web application by creating an index.html  file in it. (http://54.245.214.56:80)


Step 2: Install MySQL

MySQL is an open-source relational database management system.

To install MySQL in your server, Open terminal and type following command.

# yum install mysql-server




Start your MySQL Service y following command

# service mysqld start




After the installation, you can set a root MySQL password

# /usr/bin/mysql_secure_installation




Enter current password for root (enter for none):
OK, successfully used password, moving on...


In order to log into MySQL to secure it, we'll need the current password for the root user.  If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here.



Follow the instructions carefully to complete the confifuration




Step 3: Install PHP 

PHP is a server-side scripting language designed for web development.

To install PHP in your server, Open terminal and type following command.

# yum install php php-mysql




You can verify PHP modules and libraries by following command.

# yum search php-




To check your PHP application by creating a info.php page in /var/www/html (http://54.245.214.56/info.php)

# vim /var/www/html/info.php

Add the following line

<?php
phpinfo();
?>




Restart your apache service and test your application

# service httpd restart






No comments:

Powered by Blogger.