Last active
May 31, 2021 15:56
-
-
Save devdilson/1ddc899fb9b2dce8eb99d162af1432f5 to your computer and use it in GitHub Desktop.
User data script for EC2 instance which install apache and creates a html page with Hello world message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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
#!/bin/bash
yum update -y
amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2
yum install -y httpd mariadb-server
systemctl start httpd
systemctl enable httpd
usermod -a -G apache ec2-user
chown -R ec2-user:apache /var/www
chmod 2775 /var/www
find /var/www -type d -exec chmod 2775 {} ;
find /var/www -type f -exec chmod 0664 {} ;
echo "" > /var/www/html/phpinfo.php