There is a reason why the L in LAMP is the first letter, and not only because it makes the acronym more readable; before you can do anything else, you need a Linux installation. You might install it on bare-metal, but in this case we're going for a Virtual server using Oracle VM VirtualBox. It's a virtualization software suitable for Test and Development environments on your local PC, and not for production systems, where you might use VM Ware or KVM instead (backed by a proper storage solution).
Secondly, you need to select which Linux distribution to use, and that's an infected debate I'm not even going to get into. This guide will show you how to install CentOS 6.6, since that's what I use in my projects, and work with professionally. You want Debian or a Step-one installation of Gentoo? Go nuts!
Step 1: Get the Virtualization Software
Visit the Oracle VM VirtualBox homepage, and download a suitable version for you. When installing the software, make sure that you don't deselect any options on the "Custom setup" page . During the installation, you may get prompted about installing a new USB Device Software, which i recommend you to accept, as it's quite useful later on. Same thing goes when you're promped to install a Network Device, Service and Adapter, as it's good to have internet access when creating web applications!
It's good to know that this guide is built on version 4.3.26 on Windows 7. If you are on another version or operating system, I hope that you find the instructions somewhat familiar, at least.
Step 2: Get a CentOS Image
Visit the CentOS download page, and look for 6.6, or go directly here (64-bit x86 download page). At the time of writing, it's the latest version of Release 6, but if you read this later on, you might find it under "Archived Versions". Find a country or location that is close to you, and follow the link.
We're installing a server with specific features, so we don't need the full-feature installation. Instead we're going for the minimal installation, so the file you are looking for is named "CentOS-6.6-x86_64-minimal.iso". It's roughly 380 MB large. Download it and remember where you put it.
So now when we have installed the virtualization software, and have the Linux image, let's create a virtual machine! So start VirtualBox and familiarize yourself with the interface.
First thing to do is to click the icon "New". This will spawn a window, asking you for the name of your new virtual server. This name will not be used by the actual virtual server, it's just an identifier within VirtualBox. It's not uncommon in the linux world to name your servers after a specific theme, maybe characters in a move, or Greek mythology, but anything will do. Select "Linux" as Type, and "Red Hat (64 bit)" as Version (given that you are using the 64-bit version of CentOS, from Step 2). Click Next.
On the next page you will be given an option of how much RAM (memory) to allocate for the server. The amount is decided by how much your computer has, and what operations you are going to perform and how many servers you plan to run in parallel. For a LAMP-stack, try to keep it above 512 MB; 1-2 GB is usually sufficient to develop and test Web Service applications. The memory is of course only consumed when you have the server running.
After clicking Next, you will be given an option on how to setup the Hard Drive. The default value of 8 GB is usually sufficient, but if you know that your application will consume more, increase it as you please. I will assume that you don't have an old virtual server that you want to re-use, and that your applications actually requires a hard drive, so select the option "Create a virtual hard drive now", and click Next once again.
A new window will appear, asking you for what file type to use. If you are not looking for specific performance or data-interchange related issues, select the default value "VDI (VirtuaBox Disk Image)". The I/O performance of this storage is probably not what you should chose for your production system, but it's good enough for a development environment! Click Next again.
The next selection is static versus dynamic sized Hard Drive. If you can spare the 8 GB (or whatever size you chose in the previous step) you should go for Fixed size, as it's somewhat faster, if you're low on disk or plan to have many virtual instances on your computer, go for Dynamically allocated. Click Next.
The last option on Hard Drive that you get is confirming the size of the virtual hard drive, and the location to store it. Do not store it on a network drive! This is an incredibly bad idea, unless you have a very nice SAS/SSD Fiberchannel or iSCSI thing available. Store it on the fastest hard drive that you got - go for SSD if you have it! Give the hard drive and click Next, the virtual hard drive will now be created, it can take a minute or so to initialize.
Now the Virtual Server has been created!
Continue reading in Part 2, where we will install CentOS 6.6