Skip to content

Instantly share code, notes, and snippets.

@herrera-ignacio
Created July 26, 2019 01:01
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 24 You must be signed in to fork a gist
  • Save herrera-ignacio/4d91ae564364f9120720f6bf029b9412 to your computer and use it in GitHub Desktop.
Save herrera-ignacio/4d91ae564364f9120720f6bf029b9412 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
@jedrekdomanski
Copy link

@PrasanjitPattanaik

sudo apt-get update
sudo apt -get install apache2

Check this link for reference

@Gobinath1439
Copy link

Can yo give user data for Azure user data for an instance to install apache and show hello world. normal script to install apche2 on azure and Deploy Own page .

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