Creating a LAMP Stack (Linux, Apache, MySQL, PHP) using tasksel on Windows Azure

Introduction

I’ve covered in my previous post how to create a LAMP stack on Windows Azure using the BitNami provided image. In this post, I’ll alternatively create the lamp stack using Ubuntu’s tasksel, which gives me a more “traditional” barebones setup than the once enforced by the BitNami images.

Let’s start

Provision the machine

Create a new Virtual Machine, I’ll choose a spanking new Ubuntu 13.10

Open the HTTP port 80 in the load balancer to allow web access

Provision the server (should take about 10 minutes).

Install the required software

SSH into the new machine using PuTTy and run apt-get update

sudo apt-get update

Install the Ubuntu LAMP stack using Tasksel

sudo apt-get install tasksel
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);">sudo tasksel install lamp-server</pre>

Go through the wizard and choose your MySQL root password

After the wizard is done, if you browse to http://lampstack3.cloudapp.net you should be presented with a page like the below

Install phpmyadmin

sudo apt-get install phpmyadmin

Go through the wizard

Then enter the MySQL root password

Then define a password for the phpMyAdmin application

After phpmyadmin is installed, you need to add its configuration in the apache2.conf to be able to access it at http://lampstack3.cloudapp.net/phpmyadmin

sudo nano /etc/apache2/apache2.conf

And add the following line at the very end

Include /etc/phpmyadmin/apache.conf

Then exit and save (CTRL+X then Y)

Restart apache

sudo /etc/init.d/apache2 restart

Accessing the webserver files

The root of the webserver is located at /var/www. You need to change the ownership of that folder from root to the username you used when provisioning the machine (ex: azureuser)

sudo chown azureuser /var/www

Use any SFTP client (ex: FileZilla) to connect to lampstack3.cloudapp.net and navigate to /var/www to publish your site.

Note: This post originally appeared on my MSDN blog at http://blogs.msdn.com/b/africaapps/archive/2013/11/13/creating-a-lamp-stack-