LAMP Stack in Microsoft Azure
Tags: azure, linux, mysql, php
Published: 2023-01-13 16:28:53

Hello 👋
I am Pankaj a beginner at cloud computing ☁️ I started my journey with Linux 🐧. I learnt shell scripting and even made a few of them but I didn't know how to enforce my learnings.

So i searched for some projects to get acquainted with cloud and I came up on LAMP stack.**LAMP** is an acronym for **Linux**,**Apache Server**,**MySql**,**PHP** all of these make as a base for an application it is used widely to develop applications in the cloud.

So let's start

For this tutorial I assume you know how to create a VM in Azure if not check this from [Microsoft Learn](https://learn.microsoft.com/en-us/azure/virtual-machines/linux/quick-create-portal)

## 1.Connecting to VM
Use ssh to connect to the VM(Virtual Machine) hosted in Azure

![Azure Portal](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6kfuaipciln98o3mxvsn.png)

After connecting you might get a below screen based on the Linux VM you created I went with Ubuntu but you can use any Linux based VM

![Linux VM](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pflh2asnpazwvfc55mg8.png) 

## 2.Installing Apache server

![Command update](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ew5pq2ml7h3mkfrkmx5m.png)
Run the above command to update the apt repository


![Install command](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5p5egs17s5s8mm2aya0m.png)
Now we install apache server with the above command press Y if asked 


![Result](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xz0fpn4zsjh36epg98nr.png)
You can check if server is installed correctly by going to the ip address of the VM. If you get the above image be proud that you have completed an important task in LAMP stack.

## 3.Installing MySQL database
Now lets move onto installing MySql database

![SQL Install](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e25g2wzbi68a3ltmriqz.png) 
We will install mysql server using the above command and enter Y when asked during installation.

Now comes the part to harden the sql installation so it can be saved from attacks

![Hardening SQL Installation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mxkm6wz599lo0ut681tg.png)
After executing this command you need to set a password it should be different from the one you used for your VM (in case you used a password for connecting VM in Azure)

![Connect to SQL](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ui80ihgjutubinde2aci.png)
Connect to sql database using the password you set earlier in the previous command.
You can see you get a sql prompt if password is correct 
Type exit to come out of sql 

Finally you are done with SQL installation now lets move on to php installation

## 4.Installing PHP

![PHP installation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ak1pixxci7xs618nwpq.png)
Install php using the command above and press Y i asked during installation.

![Install phpmyadmin](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/twaatmhm8jv546v8qfzr.png)
Now we will install phpmyadmin to access the php dashboard and also for accessing the database.

## 5.Next steps
![Restart apache](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3vexo2hggqy51omoatzv.png)
We need to restart apache server in order to take efect the changes we made to system


![Apache server](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qw5yk1kw20rx5pc9d413.png)
Select the apache server using spacebar and navigate to the OK button using TAB


![Password set](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2u6bbo8b7wyu5uy3c4u2.png)
You can set the password or let phpmyadmin automatically generate one for you.

And you are done with the LAMP stack installation.
Be proud of yourself that you completed the most used task in cloud computing and Welcome to the Cloud ☁️