How to install LAMP on AWS EC2 instance

Alfredo Barron
modulr
Published in
2 min readMar 17, 2022

--

We learning how to install LAMP (Linux, Apache, MySQL, PHP) on AWS EC2 instance with Ubuntu 20.04.3 LTS

Step 1. Connect to Instance

Connect to SSH with a key through your terminal, replace your key and IP/DNS.

$ ssh -i /your-key.pem ubuntu@192.168.0.1

Step 2. Install Apache

$ sudo apt update
$ sudo apt install apache2

To verify that Apache has been installed, we write the IP or DNS of our instance in the url of our browser.

http://your_server_IP_address

We should see a screen like this:

Step 3. Install MySQL

$ sudo apt install mysql-server

Step 4. Install PHP

$ sudo apt install php libapache2-mod-php php-mysql

Step 5. Verify that PHP is installed

In our terminal we run the following command to create and edit the info.php file

$ sudo nano /var/www/html/info.php

--

--