Setup your linux server with apache, php and mysql to host websites a step by step tutorial

Lets suppose you got an empty dedicated server you ordered from a web hosting company and you want to start hosting websites which use php, mysql. Below are simple easy steps which you can take to setup your website in a few commands.
1. Install Apache 
There are many ways to install apache on your web server the most easiest way is to use yum.
yum install apache
If you dont have yum installed use this url
2. Install Php
To install php from repo you can use this article i wrote
other wise you can just use
yum install php
3. Install Mysql
To install mysql you just need to run this command
yum install mysql
Now you have installed LAMP.
Now lets configure apache so that it runs your website.
find httpd.conf or apache2.conf depending on your Os
normally they are in the /etc/ directory.
Edit the file using this command.
nano /etc/httpd/conf/httpd.conf(CentOs dir)
if you dont have nano use vi
search for VirtualHost normally this is at the end of the file.
Edit the file with your ip address and website name like this
<VirtualHost [your sever ip address]:80>
DocumentRoot /var/www/html/[your website folder]
ServerName [name of the website]

Remember the path of the DocumentRoot depends on your Os the path i used is normally on CentOS
Next step is to search for NameVirtualHost
change that to.
NameVirtualHost [your server ip]:80
thats it just save the file and restart apache
service httpd restart