02 Create Install LAMP On Virtual Machine Ubun

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 20

Create Ubuntu Virtual Machine & Configure LAMP Stack

In this document you will learn how to create Ubuntu Virtual Machine using Azure Portal. After
Creation of Virtual Machine, we will configure LAMP Stack (Linux, Apache, MySQL, PHP) on VM and
try to host website on that.

Step 1: Open Azure Portal


https://portal.azure.com

Step 2: Click on + Create a resource -> Compute-> Ubuntu Server 18.04 LTS VM
Step 3: Enter Virtual Machine Basics details
Subscription: Choose your Subscription

Resource Group: Create New -> LAMPVMRG


Virtual Machine Name: LAMPServer

Region: Choose any nearest region

Image: Ubuntu Server 18.04 LTS

Size: continue with default size or select any other size

Administrator Username: demouser

Administrator Password: Demouser@123


Public inbound ports: Allow selected ports. Select SSH (22)

Windows License: No

Click on Next: Disks > button

Step 4: Disks tab


OS disk type: Standard HDD
Step 5: Networking tab
Continue with default settings

Virtual network: Create New

Subnet: new

Public IP: new


Step 6: Management tab
Continue with default settings

Click on Next: Guest config > button

Boot diagnostics: On

OS guest diagnostics: Off

Diagnostics storage account: new storage account

Identity: Off

Auto-Shutdown: Off

Backup: Off

Note: for this demo don’t require to setup all.


Step 7: Guest config tab
Click on Next: Tags > button

Step 8: Tags tab.


Click on Next: Review + create > button
Step 9: Review + create tab
Validation passed means all settings are right and create virtual machine. If validation failed so verify
all the settings.

Virtual Machine deployment is underway. Wait for few minutes to complete


When deployment complete so click on Go to resource

Step 7: By default, RDP option like Windows not available with Ubuntu Virtual Machine so we will
use SSH for that. So, will require PuTTY software. Please download from here: https://putty.org/

Select putty.exe file based on machine like 64-bit or 32-bit.

Download and install on machine


Step 8: Now run PuTTY
Enter Ubuntu Virtual Machine Public IP Address. To start the session, click on Open button.

Click on Yes button.


Step 9: Enter VM Login Username & Password.
Ex. Username: demouser

Password: Demouser@123

Step 10: Change the user to root by typing below command:

sudo su

Because to run few command or script will require


Step 11: To update the packages run below command

apt-get update

Step 12: Tasksel is a Debian/Ubuntu tool that installs multiple related packages as a co-ordinated
"task" onto your system. Here we will install LAMP Stack (Linux, Apache, MySQL, PHP) using this
command.

apt-get install tasksel

Now run tasksel

tasksel
Step 13: Use Keyboard arrow for Up/Down & Select LAMP Server by pressing space.
Navigate to OK using TAB and hit Enter for continue.

Wait for installation


Step 14: After installation done type below command to navigate to HTML folder or where we can
save our website

cd /var/www/html

list files using below command

ls

Step 15: Create new php file using any editor.


For this demo we are using nano editor

nano default.php

Editor will open and add text into the page

<?php echo "<h1>Ubuntu Virtual Machine Demo - LAMP Stack</h1>"; ?>

After designing page press below keys

“CTRL + x” then “y” and hit “Enter”


Step 16: Now navigate to Azure Portal. Click on Resource Groups and select LAMPVMRG

Select Network Security Group


Select inbound security rules and click on + Add button

Note: Inbound port rule – An inbound rule protects the network against incoming traffic from the
internet or other network.

Click on Basic option


Choose Service: HTTP because we need to open 80 port for that. Click on Add button.

Step 17: Select Resource Group and Click on LAMPVMRG.


Select Virtual Machine Ex. LAMPServer

Step 18: Copy Public IP Address

Open Browser and paste IP address with page name.

Ex. 13.67.43.148/default.php
To Stop Virtual Machine:
Click on Stop button and click on Yes option in Overview

To Delete Virtual Machine and other resources:


Click on Resource groups (left side) & select Virtual Machine resource group
Click on Delete resource group option

Enter resource group name to confirmation of virtual machine & click on Delete button.

You might also like