Skip to content

Instantly share code, notes, and snippets.

@cmansilla
Forked from herrera-ignacio/ec2-apache.sh
Created December 14, 2020 22:50
Show Gist options
  • Save cmansilla/dc8a2c51bec070943ab7c26b430b4a47 to your computer and use it in GitHub Desktop.
Save cmansilla/dc8a2c51bec070943ab7c26b430b4a47 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