Linux, Apache, MySQL and PHP are constituents of a LAMP system (from time-to-time you may see PHP replaced or included with Perl/Python). LAMP is a modern, free, foundation that can be used to power everything from basic web pages to sophisticated web applications. Below I will go through the steps to install these components.
First off you need an installation of Linux. For this article I used Ubuntu which you can get here: www.ubuntu.com. It is one of the more popular flavors of Linux, and easy enough to install (either download an executable or burn the ISO). Ubuntu’s installation manager makes this step a breeze, so I won’t be getting into the details here. You can find the official installation information here: https://help.ubuntu.com/10.10/installation-guide/index.html.
Now to install PHP. Once you have your Linux machine booted up go to the terminal (Applications->Accessories->Terminal) and enter the following: sudo apt-get install php5. Now if we were to create a new php file and try to use something like mysql_connect() we would get an error — because we have yet to install MySQL.
To install MySQL use: sudo apt-get install mysql-server followed by sudo apt-get install php5-sql. You may want access to to the root to play with MySQL, to do so use sudo -s.
Lastly we install Apache by entering: sudo apt-get install apache2. Its that simple, now you have a LAMP enabled system.