Created
December 7, 2018 16:28
-
-
Save Metrakit/4f99365ada51a320957d238d40db8b49 to your computer and use it in GitHub Desktop.
Scripts for setup php-fpm (ready for symfony), apache2, Cerbot, Composer, Cachetool, Node, NPM, pm2
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/sh | |
echo "This script is going to setup Node, NPM, pm2" | |
echo "WARNING: The sudouser password will be prompted sometimes !" | |
echo "==> Setup Node/NPM" | |
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
node -v | |
npm -v | |
echo "==> Setup pm2" | |
sudo npm install -g pm2 | |
pm2 -v | |
echo "====== Setup okey ! ======" |
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/sh | |
echo "This script is going to setup Apache2, php7.2-fpm (ready to use for Symfony 4), Certbot, composer, cachetool)" | |
echo "WARNING: The sudouser password will be prompted sometimes !" | |
echo "==> Update all" | |
sudo apt-get upgrade -y && sudo apt-get update -y | |
echo "==> Setup apache2 & php7.2-fpm" | |
sudo apt install software-properties-common zip apache2 php7.2-cli php7.2-fpm php7.2-mbstring php7.2-pdo php7.2-pgsql php7.2-xml php7.2-zip php7.2-intl -y | |
sudo add-apt-repository universe -y | |
sudo add-apt-repository ppa:certbot/certbot -y | |
sudo apt-get update -y | |
sudo apt-get install python-certbot-apache -y | |
sudo a2enmod proxy_fcgi setenvif | |
sudo a2enconf php7.2-fpm | |
sudo systemctl reload apache2 | |
echo "==> Setup composer" | |
EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)" | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" | |
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ] | |
then | |
>&2 echo 'ERROR: Invalid installer signature' | |
rm composer-setup.php | |
exit 1 | |
fi | |
php composer-setup.php --quiet | |
RESULT=$? | |
rm composer-setup.php | |
sudo mv composer.phar /usr/local/bin/composer | |
composer -v | |
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc | |
. ~/.bashrc | |
echo "==> Setup cachetool" | |
composer global require gordalina/cachetool | |
sudo chown $USER /var/run/php/php7.2-fpm.sock | |
. ~/.bashrc | |
$HOME/.config/composer/vendor/bin/cachetool opcache:reset --fcgi=/var/run/php/php7.2-fpm.sock | |
echo "==> Checking cerbot is ready to use" | |
sudo certbot -h | |
echo "==> Checking symfony is ready to use" | |
mkdir symfony-test | |
cd symfony-test | |
composer require symfony/requirements-checker --quiet --no-interaction | |
php vendor/bin/requirements-checker | |
cd ../ && sudo rm -r symfony-test | |
echo "==> Permissions" | |
sudo chown -Rf $USER /var/www | |
echo "====== Setup okey ! For be able to use the composer binaries, take care of reload your session config : source ~/.bashrc ======" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment