Debian 10 Server Tweaks

Basic Debian system customisation and some WordPress related items.

muppetlabslogo

Evolution of the Ubuntu 16.04 Server Tweaks post.

I figured this is a good place to put some notes for next time I want to make a new server feel a bit more homely.

Basic Package Upgrades

apt-get update && apt-get dist-upgrade && apt-get clean

jed

apt-get install jed
nano /etc/jed.d/99defaults.sl
No_Backups = 1;

Locales

dpkg-reconfigure locales
Set default to en_GB
Remember to keep en_US.UTF8

Hostname

Edit /etc/hostname and add a hostname
Edit /etc/hosts and add a hostname for the server
Run hostname -F /etc/hostname

ssh

ssh-keygen -t ed25519
ssh-copy-id -i ~/.ssh/id_ed25519.pub -p 2211 user@host

Setup ssh keys.
Change the port your server runs on in /etc/ssh/sshd_config

mosh

apt-get install mosh

Postfix

apt-get install postfix
Edit /etc/mailname
Edit /etc/aliases

Make root go to an address you read
root: youremail@yourdomain.com

newaliases

Unattended Upgrades / Security Updates

apt-get install unattended-upgrades

/etc/apt/apt.conf.d/50unattended-upgrades
Unattended-Upgrade::Mail “root”;

dpkg-reconfigure -plow unattended-upgrades

/etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists “1”;
APT::Periodic::Unattended-Upgrade “1”;
APT::Periodic::Download-Upgradeable-Packages “1”;
APT::Periodic::AutocleanInterval “7”;

sudo apt install apticron

/etc/apticron/apticron.conf
EMAIL=”your@email.address”

zsh

apt-get install zsh git

Install oh-my-zsh with curl

Use this .zshrc config file to get started if you like.

Edit your .zshrc
plugins=(autojump brew pip git django python docker screen)

Change prompt colours like so:
base_prompt, play with integer values to change colours

Apache HTTP2

apt-get install apache2
a2enmod http2
a2enmod ssl
a2enmod rewrite
service apache2 restart

Add this to your vhosts:
Protocols h2 http/1.1

Check your logs when you start apache, you might have to switch to mpm_event for HTTP2 to work.

MySQL and PHP

apt-get install mariadb-server
apt-get install libapache2-mod-php
apt-get install php7.3-mysql php7.3-curl

Let’s Encrypt

apt-get install letsencrypt
letsencrypt certonly –standalone -d www.mysite.co.za -d mysite.co.za

WordPress

Installing WordPress

Create DB

Backup script

WordPress backup script, which keeps daily, weekly and monthly backups of website files and database dumps.

You probably want a similar script to backup /etc and /root.