Skip to content

Instantly share code, notes, and snippets.

@miklb
Created September 22, 2018 16:32
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 miklb/4a826400ce001cfaeaaffa63ce466691 to your computer and use it in GitHub Desktop.
Save miklb/4a826400ce001cfaeaaffa63ce466691 to your computer and use it in GitHub Desktop.
working walk through of setting up a LEMP stack

apt-get update && apt-get upgrade

hostnamectl set-hostname propJoe

dpkg-reconfigure tzdata

adduser miklb

adduser miklb sudo

ssh-copy-id user@IP

sudo chmod -R 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys

sudo nano /etc/ssh/sshd_config change allow root password change PasswordAuthentication to no change port from 22

sudo apt-get install ufw

sudo ufw default allow outgoing

sudo ufw default deny incoming

sudo ufw allow (the port you changed to in sshd_config)

sudo ufw enable

sudo apt-get install fail2ban

sudo cp /etc/fail2ban/fail2ban.conf /etc/fail2ban/fail2ban.local

sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local edit and add IP address of home connection https://www.linode.com/docs/security/using-fail2ban-for-security/

Nginx

wget https://raw.githubusercontent.com/Angristan/nginx-autoinstall/master/nginx-autoinstall.sh

sudo ./nginx-autoinstall.sh

PHP

sudo apt install ca-certificates apt-transport-https

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

sudo apt install php7.2

sudo apt install php7.2-cli php7.2-common php7.2-curl php7.2-mbstring php7.2-mysql php7.2-xml

Maria DB

sudo apt install dirmngr

apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

sudo apt update

sudo apt install mariadb-server

mysql_secure_installation

CREATE DATABASE foo; CREATE USER 'miklb'@'localhost' IDENTIFIED BY 'somepassword'; GRANT ALL PRIVILEGES ON foo.* TO miklb@localhost; FLUSH PRIVILEGES; quit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment