Debian Server Setup



This section assumes you have a fresh Debian 11 install on a server (either physical or VPS)

It will cover installing the essentials for access, and basic security so you don't need to worry in the future. This section may seem a little daunting for a first-time linux user, but most of it is copy/paste, hopefully with enough description to understand what is being done.

This first section will be done on the physical PC, or on the VPS via their website

Update the OS

Even with a fresh install of Debian from the latest ISO, there may be some updates you're missing, and it's a good idea to have these, especially in case they're security updates.

>
					
						root# apt update && apt upgrade	
					
				

Install essential packages

These are packages that are needed for accessing, and controlling the server

					
						root# apt install sudo ssh	
					
				

Some useful packages too

					
						root# apt install vim htop wget curl tmux	
					
				

Add a user, and give super user privilleges

You want to avoid using root as much as possible in regular use, so a new user for yourself is a must

					
						root# adduser 	
						root# usermod -aG sudo 
					
				

*replace with the user you want to create, e.g. nathan

Set static IP

TODO: Homeserver. If the server is a physical PC in your home you will need to set a static IP, otherwise your router could assign a differnent IP on reboot, and this would mess with port forwarding, and internal DNS.

Secure ssh

Setup UFW

Set hostname

Setting the name for a server is an important step, but the name doesn't need to be serious

This next section can be done via a terminal, or a SSH client else you can secure shell with e.g. PuTTY for Windows

Create an SSH key

SSH into the server