LAMP Stack on Microsoft Azure With Bitnami

About a year ago, Microsoft CEO Satya Nadela shared a slide claiming that “Microsoft ❤ Linux”. As of today, Microsoft is working hard with Linux and open source and most likely will stay that way for now.

Microsoft Love Linux
Microsoft Love Linux

This post will share on how to deploy LAMP; short for Linux, Apache, MySQL and PHP to Microsoft Azure using Bitnami.

Pre-requisites

  1. Azure Account. (Sign up for FREE Trial Here)
  2. Putty. (Not required if you are on Linux or Mac)

First, login to Azure Portal. You will be greeted with a nice portal.

Azure Portal
Azure Portal

 

Resource Groups

What is Resource Group? Resource group is a container that holds related resources for an application. Take it like a folder to store all your files (resources) so that you can easily locate it. Important: If you delete the resource group, you are going to delete all resources inside the resource group!

On the left sidebar, click Resource groups. Then click Add.

Under Resource Group, click Add.
Under Resource groups, click Add.

Give your Resource Group a name. For the purpose of testing, I will call it TestLAMP. Select a subscription, and select the resource group location. It is best that you select a location close to you. Eg. if you are in Singapore, choosing Southeast Asia will be best. Then click Create.

Once created, you will see the resource group under the Resource groups list. Click on your newly created resource group.

Resource Groups list
Resource Groups list

Under the selected resource group, click Add.

Inside the resource group
Inside the resource group, click Add

 

Configure Virtual Machines

Under Search Everything, key in “LAMP Stack”. The result will be shown like below. We are going to create a virtual machine to host a Linux OS (Specifically Ubuntu). Virtual machine is like an emulation of a computer system. It is a software implementation on a machine to act like a physical machine.

Bitnami LAMP Stack

Click on LAMP Stack, then next click Create.

Create LAMP Stack Virtual Machine
Create LAMP Stack Virtual Machine

When creating a virtual machine, there are 3 main steps.

Step 1, Configure the basic configurations such as login, password, and authentication method. This will be used when you use SSH to connect to the server.

Step 1: Basics
Step 1: Basics

Step 2, Choose the virtual machine size. Pick a size that you are comfortable with. For the purpose of this demo, pick A0 Standard. A0 Standard is good enough for dev and low traffic site.

lamp-bitnami-9
Step 2: Pick VM Size

Step 3, Configure optional features. Now you have options to configure your storage account type. There are 5 types of storage account type.

  1. Locally Redundant
  2. Geo-Redundant
  3. Read-Access Geo Redundant
  4. Premium Locally Redundant (DS, DSv2 or GS series Azure VMs only)
  5. Zone Redundant (only for Block Blobs)
Step 3-1: Choose a storage type
Step 3-1: Choose a storage type

Next, create a virtual network.

Step 3-2: Choose a virtual network.
Step 3-2: Create a virtual network.

Lastly, create a public IP address.

Step 3-3: Create Public IP Address
Step 3-3: Create Public IP Address

Then view Summary and Purchase

View Summary
View Summary

 

Purchase
Purchase

 

Deploying Virtual Machines

Once you completed all 5 steps, the virtual machine will now deploy. Click Refresh to retrieve the latest update.

Your virtual machine is being deployed
Your virtual machine is being deployed

As the deployment being done, notice that resources are being created under the resource group. Click on the VM will show more information about the VM.

Everything is being created under the Resource Group
Everything is being created under the Resource Group

You can view all essential details about the VM.

Details of your Virtual Machine
Details of your Virtual Machine

You can configure the DNS Name Label for your VM by going to All Settings, under General tab, click Configuration. Update your DNS Name Label and click Save.

Configure DNS Name Label for easy URL
Configure DNS Name Label for easy URL

Open your browser and hover to the provided URL. You will be presented with the below page.

View your site from the URL
View your site from the URL

 

SSH into Server

If you have yet to download Putty, do proceed to download it here.

Meanwhile, try and add /phpmyadmin to your VM’s URL address. You will be greeted with this.

lamp-bitnami-20

No worries though, we can access it later. Now, fire up Putty and fill in the HostName

Fill in Host Name
Fill in Host Name

Then under Connection, SSH, Tunnels. Fill in the below. Then click Open.

lamp-bitnami-22

Fill in the username and password.

lamp-bitnami-23
SSH into server

Try visiting localhost:8080/phpmyadmin/ and you will be able to access PhpMyAdmin as tunnel was created to point localhost:8080/ to <site>.azure.com’s localhost:80

localhost:8080/phpmyadmin/
localhost:8080/phpmyadmin/

 

Creating your first HTML page

To understand a little bit on the command shown below:

ls — to list what is in the directory (similar to dir in Command Prompt)
cd — change directory

The below image is showing what is inside ~/apps/ and ~/stack/

You can see that phpmyadmin is installed in apps. Meanwhile Apache, MySQL and PHP is installed in stack folder.

lamp-bitnami-25

To create your first page, change directory to ~/stack/apache2/htdocs/ by typing “cd ~/stack/apache2/htdocs/

lamp-bitnami-26

Move the index.html to index.html.bak by typing “mv index.html index.html.bak” followed by Enter. Then create and edit the file by typing “vim index.html” followed by Enter.

lamp-bitnami-27

Key i to insert. Add in the below text. Once done, click the Esc key, followed by :x!

Then click Enter.

lamp-bitnami-28

Refresh the URL again and the page will show like below. Congratulations! You’ve created your very first page running on LAMP.

lamp-bitnami-29

Leave a Reply