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.
This post will share on how to deploy LAMP; short for Linux, Apache, MySQL and PHP to Microsoft Azure using Bitnami.
First, login to Azure Portal. You will be greeted with a nice portal.
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.
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.
Under the selected 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.
Click on LAMP Stack, then next click Create.
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 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.
Step 3, Configure optional features. Now you have options to configure your storage account type. There are 5 types of storage account type.
- Locally Redundant
- Read-Access Geo Redundant
- Premium Locally Redundant (DS, DSv2 or GS series Azure VMs only)
- Zone Redundant (only for Block Blobs)
Next, create a virtual network.
Lastly, create a public IP address.
Then view Summary and Purchase
Deploying Virtual Machines
Once you completed all 5 steps, the virtual machine will now deploy. Click Refresh to retrieve the latest update.
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.
You can view all essential details about the VM.
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.
Open your browser and hover to the provided URL. You will be presented with the below page.
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.
No worries though, we can access it later. Now, fire up Putty and fill in the HostName
Then under Connection, SSH, Tunnels. Fill in the below. Then click Open.
Fill in the username and password.
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
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.
To create your first page, change directory to ~/stack/apache2/htdocs/ by typing “cd ~/stack/apache2/htdocs/”
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.
Key i to insert. Add in the below text. Once done, click the Esc key, followed by :x!
Then click Enter.
Refresh the URL again and the page will show like below. Congratulations! You’ve created your very first page running on LAMP.