Been a while since I’ve covered setting up a brand new LAMP server. This time, I’m going to be using Ubuntu 13.10 and once you are logged into your server you will want to update and upgrade it to the latest software versions:

sudo apt-get update && apt-get upgrade

Once that’s done running, you may want to restart the server. After that, we need to install the basic components of the LAMP stack. The L in LAMP is already covered since you’re on a Linux server, the rest of what we need is Apache, MySQL and PHP:

sudo apt-get install apache2 mysql-server php5 php5-mysql

You wil be prompted to set a password for the MySQL “root” user, which I highly recommend you doing. Once the software is installed, you can point your web browser to the IP address of the server and you should see something like this:

It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.

Sweet! We have Apache set up and it’s ready to go. Wait, not so fast, that was just a static page and we want to make sure that PHP is working correctly. To check that PHP is in fact configured properly we need to create a PHP script and test it out. I prefer to create a script that contains phpinfo() that will display a bunch of information about PHP. You can pull this off with a single command from the shell:

echo '<?php phpinfo(); ?>' > /var/www/phpinfo.php

Now that the file is created, point your browser to the same IP as before and add /phpinfo.php to the end. When it loads, you should see the PHP logo, the version and a bunch of information about the PHP setup.

Stuff like setting up virtual hosts would be your next steps but is out of the scope of this post but at this point you have a very basic LAMP server up and running!