Skip to content

Instantly share code, notes, and snippets.

@mukundparmar
Forked from herrera-ignacio/ec2-apache.sh
Created January 11, 2021 16:42
Show Gist options
  • Save mukundparmar/8d8324cf1de9c74b3f8d9db9bb4d0188 to your computer and use it in GitHub Desktop.
Save mukundparmar/8d8324cf1de9c74b3f8d9db9bb4d0188 to your computer and use it in GitHub Desktop.
EC2 User data: install Apache web server for Amazon Linux 2 Image
#!/bin/bash
########################################
##### USE THIS WITH AMAZON LINUX 2 #####
########################################
# get admin privileges
sudo su
# install httpd (Linux 2 version)
yum update -y
yum install -y httpd.x86_64
systemctl start httpd.service
systemctl enable httpd.service
echo "Hello World from $(hostname -f)" > /var/www/html/index.html
@mukundparmar
Copy link
Author

sample httpd userdata setup script, Just copy and paste in AWS userdata block during launch ec2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment