Skip to content

Instantly share code, notes, and snippets.

@nenodias
Forked from herrera-ignacio/ec2-apache.sh
Created December 8, 2020 18:33
Show Gist options
  • Save nenodias/ceba4d676547ef523f6dc701f8b7e96d to your computer and use it in GitHub Desktop.
Save nenodias/ceba4d676547ef523f6dc701f8b7e96d 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment