Setup LAMP Server Debian 9 Apache 2.4 MarianDB Php 7

Prerequisite is a fresh remote server with Debian 9 Stretch installed and booted

From remote terminal

Block all traffic

iptable -F
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

Create a User

sudo useradd -d /home/username -m username

Set the User’s Password

sudo passwd username

Add the User to the Admin Group

sudo adduser username adm

Add user to sudoers (Debian)

sudo adduser username sudo
sudo vi /etc/sudoers

give permissions to your new user – below root
username ALL=NOPASSWD: ALL

chsh -s /bin/bash username

install rsync

Disable mouse in VIM

Enable rc.local

Check status

sudo systemctl status rc-local
sudo chmod +x /etc/rc.local

http://www.itechlounge.net/2017/10/linux-how-to-add-rc-local-in-debian-9/

sudo apt install marianDB apache2 mod_ssl openssl php7.0 php7.0-curl net-tools grc php-mbstring

Block ipv6
sudo vi /etc/sysctl.conf

Setup Apache2.4
Setup Psad
Setup Fail2ban

You may also like...