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

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

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...