Skip to content

Instantly share code, notes, and snippets.

@valorin
Created Oct 10, 2020
Embed
What would you like to do?
#!/bin/bash -xe
if [[ $WSL_DISTRO_NAME = Ubuntu* ]]; then
sudo add-apt-repository ppa:ondrej/php -y
if [ $WSL_DISTRO_NAME == "Ubuntu-18.04" ]; then
sudo add-apt-repository ppa:certbot/certbot -y
fi
fi
if [ $WSL_DISTRO_NAME == 'Debian' ]; then
sudo apt install -y ca-certificates apt-transport-https wget gnupg2
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
fi
sudo sed -i "s/%sudo\tALL=(ALL:ALL) ALL/%sudo\tALL=(ALL:ALL) NOPASSWD:ALL/" /etc/sudoers
sudo apt -y update
sudo apt -y upgrade
sudo apt -y dist-upgrade
sudo apt -y autoremove
sudo apt install -y rsync zip mosh vim htop grc bash-completion git-extras
sudo apt install -y php7.4-bcmath php7.4-cli php7.4-curl php7.4-gd php7.4-imagick php7.4-intl php7.4-json php7.4-mbstring php7.4-readline php7.4-sqlite3 php7.4-xsl php7.4-zip
mkdir -p /home/valorin/.local/bin
if [ ! -f /home/valorin/.local/bin/composer ]; then
wget https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer -O - -q | php -- --quiet --install-dir=/home/valorin/.local/bin --filename=composer
fi
if [ -f /home/valorin/.config/composer/composer.json ]; then
/home/valorin/.local/bin/composer global update
fi
if [ -f /home/valorin/.composer/composer.json ]; then
/home/valorin/.local/bin/composer global update
fi
/home/valorin/.local/bin/composer global require psy/psysh friendsofphp/php-cs-fixer laravel/installer laravel/lumen-installer laravel/envoy
if [ $WSL_DISTRO_NAME == "WLinux" ] || [[ $WSL_DISTRO_NAME = Ubuntu* ]]; then
sudo apt install -y php7.4-fpm php7.4-mysql php-redis mysql-server mysql-client build-essential patch ruby-dev zlib1g-dev liblzma-dev sqlmap nginx certbot python3-certbot-nginx python3-certbot-dns-cloudflare libsqlite3-dev ansible redis-server
sudo gem install mailcatcher
sudo usermod -G valorin www-data
sudo sed -i "s/www-data/valorin/" /etc/php/7.4/fpm/pool.d/www.conf
sudo sed -i "s/^bind-address/#bind-address/" /etc/mysql/mysql.conf.d/mysqld.cnf
sudo sed -i "s/^upload_max_filesize = .*M/upload_max_filesize = 32M/" /etc/php/7.4/fpm/php.ini
sudo sed -i "s/^post_max_size = .*M/post_max_size = 32M/" /etc/php/7.4/fpm/php.ini
sudo sed -i "s/^;sendmail_path =.*$/sendmail_path = \/usr\/bin\/env catchmail -f php@pengwin/" /etc/php/7.4/cli/php.ini
sudo sed -i "s/^;sendmail_path =.*$/sendmail_path = \/usr\/bin\/env catchmail -f php@pengwin/" /etc/php/7.4/fpm/php.ini
if [ $WSL_DISTRO_NAME != "Ubuntu-16.04" ]; then
sudo gem install wpscan
wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O ~/.local/bin/wp
chmod +x /home/valorin/.local/bin/wp
fi
echo "sudo apt -y update && sudo apt -y upgrade && sudo apt -y dist-upgrade && sudo apt -y autoremove && composer self-update && wp cli update && wpscan --update" >> ~/.bash_history
else
echo "sudo apt -y update && sudo apt -y upgrade && sudo apt -y dist-upgrade && sudo apt -y autoremove && composer self-update" >> ~/.bash_history
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment