Created
January 10, 2020 23:03
-
-
Save mstaack/00c5c45dbe769a4725d423868918bed6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# Simple Server Setup Script | |
# M. Staack - 2020 | |
set -e | |
# Base | |
sudo apt update | |
sudo apt upgrade -y | |
sudo apt-get install -y software-properties-common git curl zip unzip nginx glances htop nethogs | |
# Let's Encrypt | |
sudo add-apt-repository -y ppa:certbot/certbot | |
sudo apt update | |
sudo apt install -y python-certbot-nginx | |
# PHP | |
sudo add-apt-repository -y ppa:ondrej/php | |
sudo apt-get update | |
sudo apt-get install -y php7.4-common php7.4-cli php7.4-curl php7.4-intl php7.4-mbstring | |
sudo apt-get install -y php7.4-fpm php7.4-soap php7.4-bcmath php7.4-imap php7.4-xml php7.4-zip | |
sudo apt-get install -y php7.4-pgsql php7.4-sqlite php7.4-mysql php7.4-mongodb | |
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer | |
# PHP Config | |
sudo sed -i "s/post_max_size = 8M/post_max_size = 300M/g" /etc/php/7.4/fpm/php.ini | |
sudo sed -i "s/upload_max_filesize = 2M/upload_max_filesize = 300M/g" /etc/php/7.4/fpm/php.ini | |
sudo sed -i "s/expose_php = On/expose_php = Off/g" /etc/php/7.4/fpm/php.ini | |
sudo sed -i 's#^;date\.timezone[[:space:]]=.*$#date.timezone = "Europe/Berlin"#' /etc/php/7.4/fpm/php.ini | |
sudo service php7.4-fpm restart | |
# Node | |
curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh | |
sudo bash nodesource_setup.sh && rm nodesource_setup.sh | |
sudo apt-get install -y nodejs | |
# Yarn | |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | |
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | |
sudo apt update | |
sudo apt install -y --no-install-recommends yarn | |
# Firewall | |
sudo ufw default deny incoming | |
sudo ufw default allow outgoing | |
sudo ufw allow https comment 'Open all to access Nginx port 443' | |
sudo ufw allow http comment 'Open access Nginx port 80' | |
sudo ufw allow ssh comment 'Open access OpenSSH port 22' | |
sudo ufw enable --force | |
# Finish | |
sudo apt update | |
sudo apt upgrade -y | |
sudo apt-get clean | |
sudo apt-get autoremove -y | |
sudo reboot | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment