Skip to content

Instantly share code, notes, and snippets.

@crappyrules
Last active September 15, 2020 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crappyrules/fc878af6f827c6217a6af670aa70b77b to your computer and use it in GitHub Desktop.
Save crappyrules/fc878af6f827c6217a6af670aa70b77b to your computer and use it in GitHub Desktop.
lemp development server install
#!/bin/bash
# This script will install all needed dependencies.
# Set repositories and update apt
mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo "deb http://deb.debian.org/debian/ buster main contrib non-free
deb-src http://deb.debian.org/debian/ buster main contrib non-free
deb http://deb.debian.org/debian/ buster-backports main contrib non-free
deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main
# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main
deb-src http://deb.debian.org/debian/ buster-updates main" > /etc/apt/sources.list
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 90\n' > /etc/apt/preferences.d/limit-unstable
apt update && apt upgrade -y
# These are dependencies
apt install -y build-essential python-dev cron sudo git curl nginx unzip screen wireguard magic-wormhole autoconf libc-dev pkg-config mariadb-server mariadb-client aptitude screenfetch
#install php for the lulz
apt -y install lsb-release apt-transport-https ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
apt update && apt upgrade -y
apt-get install -y php php-fpm php-mysql php-common php-cli php-common php-json php7.4-opcache php-readline php-mbstring php-xml php-gd php-curl php-gd php-bz2 php-zip php-tcpdf
aptitude -t buster-backports install -y php-twig
#setup nginx for usage with php
rm -rf /etc/nginx/sites-available/default
wget https://gist.githubusercontent.com/crappyrules/36577f0d21e4963f25366895043695f5/raw/f92fb7b4206b7318b16274d9c17a4f3651442f86/default -O /etc/nginx/sites-available/default
echo "<?php phpinfo(); ?>" > /var/www/html/info.php
systemctl enable php7.4-fpm
systemctl start php7.4-fpm
systemctl restart nginx
wg genkey | tee wg-private.key | wg pubkey > wg-public.key
mv wg-private.key wg-public.key /etc/wireguard
rm /etc/motd
wget https://gist.githubusercontent.com/crappyrules/dd8152f43ec920d3feebba1454879043/raw/becdad55e57c22de1aa94d873f200bee77b9b5ca/motd -O /etc/motd
echo "STATION"
apt install -y phpmyadmin
ln -s /usr/share/phpmyadmin/ /var/www/html/phpmyadmin
echo "setup your stupid database user and you're done"
newUser='testuser'
newDbPassword='rekt1'
newDb='testdb'
host=localhost
#host='%'
commands="CREATE DATABASE \`${newDb}\`;CREATE USER '${newUser}'@'${host}' IDENTIFIED BY '${newDbPassword}';GRANT USAGE ON *.* TO '${newUser}'@'${host}' IDENTIFIED BY '${newDbPassword}';GRA$
TO '${newUser}'@'${host}';FLUSH PRIVILEGES;"
echo "${commands}" | /usr/bin/mysql -u root -p
echo "done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment