Jump directly to main content

Debian Install Guide for Servers



Debian is a fantastic linux distrubution that works, and rarely causes issues. Due to this, it is a common canditate for a server OS, and is what this guide will walkthrough how to install on a PC.

Assumptions

You have a PC/laptop with an internet connection

You have a PC/laptop/VM to install Debian to

You have a USB that can be rewritten with the debian ISO

You're on a network with DHCP (the typical home network will be)

Currently assumes you boot via BIOS, not UEFI (Will be updated for UEFI too)

Download and Burn the ISO

First thing is to get the install media setup. If you know how to burn an ISO, go ahead and get that done, I'll wait for you in the next section. If not follow below.

Download the latest debian ISO from the debian distrubution page, at the time of writing it's this release (assuming you're installing on a 64bit PC), but get it from their page.

Download Balena Etcher for your device (Windows, MacOS, Linux), and install it

Then open Etcher (with an empty USB plugged in), select the USB, and the downloaded ISO image, then hit run.

When finished remove the USB and plug it into the PC you want to install Debian to

Boot from the USB

You may be able to just plug the USB in, boot the PC, and be greeted with the installer. If so great! If not, then read on.

BIOS boot order

When your PC boots you should see a screen with a logo (a splash screen), hit a one of the button it tells you (Normally Esc, Del, F2, F3, or F12) to enter the bios. Find your bios's boot section, and move the USB to boot priority 1. After a reboot your PC will now always attempt to boot from your USB first, and from your internal drive if it cannot.

One time boot

Like above, press the key to get into either a one-time boot menu, or the bios. From there select your USB as a boot override. This will boot from the USB just this time, and then revert to the normal boot order.

Start install

When you're greeted by a debian boot page, select "Install" (that's what I'll be using) but "Graphical Install" is also fine, as it's essentially the same thing, but you can use a mouse.

Localisation

As if you are filling out an online form, simply ensure the boxes are correct to your language, location (sets time, and download servers), and keyboard layout.

Hostname

What you wish to call your server, I like to give names that are quirky, but still kinda explain what they do. For example, some names I've used are "spiderverse" for a web server, and "lilnas" for a NAS, etc.

Domain name

Leave this as default "home", and hit continue.

Set up users and password

The first thing you'll see is a screen asking for a root password.

Don't set a root password

Simply hit the Enter key, then again when it asks for the password the second time. A root user with a password is a vulnerability, so we're avoiding this.

Create your user (admin account)

Now enter your username, and password as the installer requests.

This account will be added to the sudo group, making it an admin with that can act as the root user.

Disk Partitioning

For this I am assume you're using a new drive, or at least one that you don't want any of the data on it

Guided/Auto-partitioning

You can do this, and it's recommended if you're new to linux. Once you've got the hang of it, you can always re-install your server from scratch (I recommend this a couple of times if it's non-integral).

Select Guided - use entire disk then select the drive you want to boot from.

Then select All files in one partition (recommended for new users), as it's the simplest option.

Manual Partitioning

I've opted to leave this out, as it's a beginner guide. If you're reading this though I typically don't create a swap partition, but the guided installer does. It's no problem, but following this guide makes it redundant.

(Optional) Preferences

With your disk partitioned select the partion that has a / at the far right, and hit Enter.

Go to Mount Options, and select (using Space) noatime, and nodiratime. Then hit Enter, and select Done setting up the partition.

Finalising Partitioning

Simply hit Enter on Finish partitioning and write changes to disk at the bottom of the page.

Another screen will appear to verify you wish to partition, hit Yes, and it'll begin partitioning. Give it a little time.

Configure the package manager

A simple one, select your country, hit enter to the top selection, hit enter again when it asks for a proxy (unless you know what you're doing), and sorted.

Popularity Contest

I typically select No here, but read what it is and select for yourself.

Software Selection

Now tasksel will load up, and ask if you want any software installed during setup.

I choose to deselect everything pre-selected (the ones with asterisks), however for a new setup keeping standard system utilities is a-ok.

If you're after a GUI experience you can select Xfce as it's pretty lightweight, however I'd recommend going with no GUI for a server.

Once you've selected what to install, hit Enter.

Reboot, and enjoy!

Reboot your server, and tada!

Setup Swap

I mentioned earlier I don't setup a swap partition, and that it'd be redundant if you follow this guide, so here we go.

Swap sizes vary per PC as different services use more RAM, etc. A decent(ish) rule of thumb is to set half your RAM size as the swap size, but to be honest 8GB will likely suffice.

Create the swap file

sudo fallocate -l 8G /swapfile

Set permissions

sudo chmod 600 /swapfile

Set the file as a swap area

sudo mkswap /swapfile && sudo swapon /swapfile

Set on boot

Open /etc/fstab with a text editor. I'll use vi for this.

sudo vi /etc/fstab

Press gg, followed by Shift+o, then type the following.

/swapfile swap swap defaults 0 0

Then press esc, followed by shift+ZZ.

Next steps

Now that you've got a basic Debian install, you'll need to configure, and install a few things. I've written a little something, somthing like that, so check how to setup a new server install