Basic Setup - First 5 minutes on a new server
- Copy SSH ID:
ssh-copy-id - Update server:
sudo apt update; sudo apt upgrade - Firewall:
apt install ufwufw allow sshufw enable
- Reboot server:
reboot - Install mosh:
apt install moshufw allow 60000:61000/udpufw enable
- Create new user:
adduser tomusermod -aG sudo tom
- Add server to local SSH config and give it a name.
- Reconnect to server:
mosh name - Install vim:
sudo apt install vim - Configure default editor:
update-alternatives --config editor - Lock the root account to disable root login:
sudo passwd -l root
Preference is security, not availability.
- Unattended upgrades:
sudo apt install unattended-upgrades - Fail2ban:
sudo apt install fail2ban - Restart each week:
sudo crontab -e5 3 * * 1 reboot
Postfix as mailforwarder:
- Install postfix:
sudo apt install postfix - Choose internet with smart host
- Choose your domain name
- Choose the SMTP server
- Install sasl support:
sudo apt install libsasl2-modules - Edit
/etc/postfix/main.cf:- Before
relayhost:
- Before
smtp_sasl_auth_enable = yes
smtpd_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/smtp_auth
smtp_tls_security_level = encrypt
smtp_tls_note_starttls_offer = yes
- Create the mentioned
/etc/postfix/smtp_authwith the following content:mail.server.com user:passwort
- Create the db file:
sudo postmap /etc/postfix/smtp_auth - Delete the input file:
sudo rm /etc/postfix/smtp_auth - Rename the senders:
sudo vim /etc/postfix/genericwith the following content:@hostname your@sender.address
- Restart postfix server:
sudo systemctl restart postfix
Test postifx:
-
Install
mailcommand:sudo apt install mailutils -
Send test mail:
mail -s "test" thomas@irgang.eu < /dev/null -
Watch logs:
journalctl -fand check mail inbox -
Install useful tools:
sudo apt install vim git tmux htop ripgrep python3 python3-venv -
Install docker and docker compose:
sudo apt install docker.io docker-compose docker-cli docker-buildxsudo usermod -aG docker your_user