How to install Apache webserver in Ubuntu or in Amazon Machine Image

sudo apt update
sudo apt install apache2
sudo service apache2 start
sudo service apache2 stop

 

yum update -y
yum install httpd -y
service httpd start
cd /var/www/html
nano index.html
My webserver is running!!!

#!/bin/bash
yum update -y
yum install httpd -y
cd /var/www/html
echo "Good Morning...Welcome to Webserver" >index.html
service httpd start
chkconfig httpd on