Installing Apache on CentOS

Install Apache with the following command to begin the install:
  • sudo yum install httpd
Start Apache with the following command:
  • sudo service httpd start
We can now verify Apache is working by opening your browser and entering the URL http://your-server's-address. you should get a blue Apache 2 test page similar to the image below.
Note: If you do not know your IP address, run the following command:
  • ip addr show eth0



Installing MySQL on CentOS


Install MySQL with the following command to begin the install:
  • sudo yum install mysql-server
Start the service with the following command
  • sudo service mysqld start
Set root MySQL password with the following command:
  • /usr/bin/mysql_secure_installation

Installing PHP on CentOS


Install PHP with the following command to begin the install:
  • sudo yum install php php-mysql
Create a test PHP file in the following directory with the following command:
  • sudo vi /var/www/html/info.php
Insert the following code in the empty space then save and exit:
  • <?php
  • phpinfo();
  • ?>
Restart apache so all the changes take effect:
  • sudo service httpd restart
Test your page in your browser with the following hyperlink changed with your IP address:
http://YOUR.IP.ADD.RESS/info.php

It is a good idea to remove your php.info file as it can be used to aid an attacker to compromise your server. You can do that with the following command:
  • sudo rm /var/www/html/info.php
If you would like Apache and MySQL to start on boot, run the following commands:
  • sudo chkconfig httpd on
  • sudo chkconfig mysqld on
Congratulations! You have just installed a LAMP stack on your Centos

Post a Comment

 
NETWORKSTIP Networking CCNA,Centos,Ubuntu,Sql, © 2013. All Rights Reserved. Shared by NetworksTip Muhammad Nafees
Top