Last active
August 10, 2020 08:32
-
-
Save milanchheda/086302b4e677ad377b855fb2de2d6983 to your computer and use it in GitHub Desktop.
EC2 user data to install laravel requirements on Ubuntu
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
#!/usr/bin/env bash | |
sudo apt-get install software-properties-common | |
sudo add-apt-repository ppa:ondrej/php -y | |
sudo apt-get update | |
sudo apt-get install curl -y | |
# PHP 7.4 installation steps | |
sudo apt-get install php7.4 -y | |
sudo apt-get install php7.4-cli php7.4-curl php7.4-mysql php7.4-common php7.4-bcmath openssl php7.4-json php7.4-zip php7.4-mbstring php7.4-xml php7.4-gd php7.4-fpm -y | |
sudo apt install npm -y | |
npm cache clean -f | |
sudo npm install -g n | |
sudo n stable | |
# Git Installation | |
sudo apt-get install git -y | |
# Nginx installation steps | |
sudo apt-get install nginx -y | |
sudo systemctl stop apache2.service | |
sudo systemctl restart nginx.service | |
sudo systemctl enable nginx.service | |
sudo systemctl enable php7.4-fpm.service | |
# Composer installation | |
sudo 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 | |
sudo apt install mysql-client-core-5.7 -y | |
sudo apt-get install supervisor -y | |
# Redis installation | |
# sudo apt-get install -y redis-server | |
# Googlers, do not use composer with sudo: | |
# Add your user in the www-data group (this action require you to logout and login again) | |
sudo usermod -a -G www-data `whoami` | |
# Give the right permissions to /var/www | |
sudo chown root:root /var/www | |
sudo chmod 755 /var/www/ | |
# Give these permissions to your project | |
sudo chown -R www-data:www-data /var/www/<project> | |
sudo chmod -R 774 /var/www/<project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment