Skip to content

Instantly share code, notes, and snippets.

@timothymarois
Last active August 12, 2020 00:33
Show Gist options
  • Save timothymarois/098bddfbb56af0f05446116e2f5d048d to your computer and use it in GitHub Desktop.
Save timothymarois/098bddfbb56af0f05446116e2f5d048d to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Amazon Linux 2 EC2 to PHP 7.3
#
# Must be ran as sudo:
# sudo sh env-setup-AMI2.sh
#
# Install Git
sudo yum install -y git
# Install Apache 2.4 + PHP 7.3
sudo yum install -y httpd
sudo amazon-linux-extras install -y php7.4
# These are already installed by the php install:
# yum install -y php-json
# yum install -y php-common
# yum install -y php-process
# yum install -y php-cli
# Install the extras:
sudo yum install -y php-bcmath
sudo yum install -y php-mbstring
sudo yum install -y php-opcache
sudo yum install -y php-soap
sudo yum install -y php-gd
sudo yum install -y php-xml
# Restart Apache.
sudo systemctl restart httpd
# Install Composer
curl -sS https://getcomposer.org/installer | sudo php
sudo mv composer.phar /usr/local/bin/composer
sudo ln -s /usr/local/bin/composer /usr/bin/composer
# Install certbot for SSL
cd /tmp
wget -O epel.rpm –nv \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y ./epel.rpm
sudo yum install -y python2-certbot-apache.noarch
# Create env directories
mkdir /var/www/html/staging
mkdir /var/www/html/develop
mkdir /var/www/html/production
sudo usermod -a -G apache ec2-user
sudo chown -R ec2-user:apache /var/www
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment