You can use the script below to install and start the apache server on Ubuntu ec2 instance launch.

#!/bin/bash
sudo apt update -y
sudo apt install -y apache2
sudo systemctl start apache2
sudo systemctl enable apache2

Answer from Sanim16 on Stack Overflow
๐ŸŒ
DEV Community
dev.to โ€บ suravshrestha โ€บ install-apache-web-server-in-amazon-linux-ec2-instance-3e38
Install Apache Web Server in Amazon Linux EC2 Instance - DEV Community
May 27, 2024 - Installing a web server is a foundational step in web development and server management. Apache is one of the most popular web servers due to its reliability and extensive features. In this guide, we'll walk you through the steps to install and configure the Apache Web Server on an Amazon Linux AWS EC2 instance.
Discussions

Help with configuring PHP / Apache on Amazon Linux EC2
Sounds like you're just not used to navigating Linux without a GUI. Once you're SSH'd in, there's nothing to do with AWS IAM nor CLI. It's all regular Linux at that point. Why don't you browse your machine and find out what you have? Maybe you have php 7.3 instead of 7.2. cd /etc/ , ls, etc... More on reddit.com
๐ŸŒ r/aws
9
1
May 27, 2022
Log4j 0day being exploited
example host scanning for this, look at the user-agent strings here https://greynoise.io/viz/ip/45.155.205.233 decodes to curl or wget commands (when you b64 unencode it), each passed off to a different IP More on reddit.com
๐ŸŒ r/blueteamsec
85
518
December 17, 2021
๐ŸŒ
Amazon Web Services
docs.aws.amazon.com โ€บ amazon rds โ€บ user guide โ€บ getting started with amazon rds โ€บ tutorial: create a web server and an amazon rds db instance โ€บ install a web server on your ec2 instance
Install a web server on your EC2 instance - Amazon Relational Database Service
After the updates complete, install the Apache web server, PHP, and MariaDB or PostgreSQL software using the following commands. This command installs multiple software packages and related dependencies at the same time. ... If you receive an error, your instance probably wasn't launched with an Amazon Linux 2023 AMI. You might be using the Amazon Linux 2 ...
๐ŸŒ
CloudKatha
cloudkatha.com โ€บ home โ€บ how to install apache web server on amazon linux 2
How to Install Apache Web Server on Amazon Linux 2 - CloudKatha
August 29, 2023 - Today, I am here to help you install apache web server on amazon Linux 2. Linux 2: Linux 2 is a very very popular Linux AMI provided by AWS i
๐ŸŒ
TecAdmin
tecadmin.net โ€บ install-apache24-php7-on-amazon-linux
How to Install Apache 2.4 & PHP 7.4 on Amazon Linux โ€“ TecAdmin
April 26, 2025 - The Apache (httpd) packages are available under the default yum repositories on Amazon Linux 2 systems. Execute the following command on the terminal to install Apache with mod_ssl:
๐ŸŒ
Medium
medium.com โ€บ @laxmijayannavar โ€บ install-apache-web-server-on-amazon-linux-2-74c0f8f73dc6
Install Apache web server on Amazon Linux 2 | by Laxmi Jayannavar | Medium
January 6, 2023 - Step 2: Install apache server by running the following command and check the status ... Since the status of the service is inactive we have to start the service and recheck the status with the following commands.
๐ŸŒ
AWS
docs.aws.amazon.com โ€บ amazon linux โ€บ user guide โ€บ al2 on amazon ec2 โ€บ al2 tutorials โ€บ tutorial: install a lamp server on al2
Tutorial: Install a LAMP server on AL2 - Amazon Linux 2
If any of the required packages ... sudo yum install package command. Also verify that the php7.2 and lamp-mariadb10.2-php7.2 extras are enabled in the output of the amazon-linux-extras command. Delete the phpinfo.php file. Although this can be useful information, it should not be broadcast to the internet for security reasons. ... You should now have a fully functional LAMP web server. If you add content to the Apache document root ...
Find elsewhere
๐ŸŒ
CloudKatha
cloudkatha.com โ€บ home โ€บ how to install apache web server on amazon linux 2023
How to Install Apache Web Server on Amazon Linux 2023 - CloudKatha
August 22, 2023 - Below I am specifying the set of commands that you need to run to install the Apache Web Server on your Amazon Linux 2023 instance. Also, note that you will use sudo(root privilege ) to run all these commands. The reason is that whenever you try to install, remove or change any software, you must have root privilege to do such tasks. If you have used Amazon Linux 2, you might remember that we used to use the yum command and used to install httpd from the amazon-linux-extras repo.
๐ŸŒ
Mohammad Abu Mattar
mkabumattar.com โ€บ home โ€บ blog โ€บ post โ€บ how to install apache web server on amazon linux 2
How to Install Apache Web Server on Amazon Linux 2
October 24, 2022 - Now, we can test Apache web server by opening the public IP address of our Amazon Linux 2 EC2 instance in a web browser: In this tutorial, we learned how to install Apache web server on Amazon Linux 2.
๐ŸŒ
Medium
medium.com โ€บ @felixmomodebe โ€บ how-to-configure-apache-webserver-on-aws-linux-ec2-machine-1eab7009ea32
How to Configure Apache Webserver on AWS Linux EC2 Machine. | by Felix Momodebe | Medium
January 9, 2024 - Install and Configure Apache Webserver: Connect to your EC2 instance directly through the EC2 Instance Connect or via SSH Client (such as: putty, MobaXterm, Termius, macOS terminal, VSCode, linux terminal, etc).
๐ŸŒ
Medium
medium.com โ€บ @jahmekyapage โ€บ create-an-apache-web-server-using-an-amazon-linux-2-ec2-instance-e3742c48e297
Create an Apache web server using an Amazon Linux 2 EC2 instance | by Jahmekya Page | Medium
October 6, 2024 - I created an EC2 instance (Apache-1) and made sure to select Linux 2 for my OS. I also created a new key pair for this type of instance and kept the remaining settings as default. I then made sure to select allow SSH and allow HTTP for my security rules. ... Once the instance was good to go, I opened my command prompt terminal and proceeded to SSH into the instance. After I was in, I then switched to the root user in order to run the system update and Apache install commands.
๐ŸŒ
Medium
medium.com โ€บ @mutaigilbert85 โ€บ mastering-automation-deploying-an-apache-web-server-on-amazon-ec2-with-aws-cli-6cdd3b867a35
Mastering Automation: Deploying an Apache Web Server on Amazon EC2 with AWS CLI | by Gilbert Mutai | Medium
November 21, 2024 - Copy the AMI ID of the Amazon Linux 2 AMI, which typically looks like ami-xxxxxxxxxxxxxxxxx. ... Weโ€™ll create a bootstrap script that will install and configure Apache Web Server when the EC2 instance starts.
๐ŸŒ
JumpCloud
jumpcloud.com โ€บ home โ€บ blog โ€บ how to install lamp server on amazon linux 2
How to Install LAMP Server on Amazon Linux 2 - JumpCloud
An Amazon Linux 2 EC instance already launched and running. A security group configured to allow ports 22 and 80. SSH access to the EC2 instance from the terminal or using PuTTY SSH client. When you are connected to the EC2 instance using SSH, you should see the prompt shown below. To get started with the installation of Apache, be sure to update all the packages to their latest versions as follows:
Published ย  January 26, 2024
๐ŸŒ
Tutorialswebsite
tutorialswebsite.com โ€บ home โ€บ all articles
install apache on aws ec2 instance
In this article, Iโ€™ll show you how to install MySQL server on AWS Amazon Linux EC2 machine, which will hopefully help you get started with your project deployment to AWS. So, since Amazon Linux 2 is a popular webserver operatingโ€ฆ
๐ŸŒ
Medium
aws.plainenglish.io โ€บ installing-an-apache-web-server-on-an-ec2-instance-magic-in-the-fundamentals-9173a4c0d413
Installing an Apache Web Server on an EC2 Instance: Magic in the Fundamentals | by Jessie Redd Jr. | AWS in Plain English
November 8, 2024 - Objective: Install an Apache Web Server onto an EC2 Instance and display an HTML file ยท Navigate to the AWS Management Console. Go to the EC2 service to create our EC2 instance, on which our LUIT website will be statically hosted using an Apache ...