Installing Debian

Option 1: Get a server with Debian Bookworm pre-installed

If you rent a virtual server at your favorite hosting company it often comes with Debian pre-installed. If you have a chance to change the partitioning then consider the schema shown below. Otherwise feel free to skip this page.

Option 2: Get a server with the older Debian Bullseye

Your hosting company does not offer Debian Bullseye yet but just Debian Bullseye? No big deal. Just change your /etc/apt/sources.list file to:

deb http://deb.debian.org/debian bookworm main
deb http://deb.debian.org/debian bookworm-updates main
deb http://security.debian.org/debian-security bookworm-security main

Run “apt update” and “apt dist-upgrade” and you are ready.

Option 3: Install Debian yourself

You have a blank computer or virtual machine? Then simply install Debian Bookworm yourself. Get a boot medium from the Debian website. The smaller network installer is sufficient – it will download all required packages directly from the internet. Make sure you choose ‘English’ as the installation language even if it is not your native language. If you have trouble with the server you will more likely find help when searching for English error messages on the internet.

Most of the installation is pretty straightforward. You don’t need me holding your hand. I strongly recommend that you use the logical volume manager (LVM) for your partitions to stay flexible if your server grows. See my article on LVM if you want some help understanding its concept.

Partitioning

The only part that takes some patience is when it comes to partitioning your disk. Throughout this tutorial you will store your users’ emails in the /var/vmail partition. The MariaDB database will live in /var/lib/mysql and is usually pretty small even for a large number of email accounts – so that usually does not require a separate partition. Log files go to /var/log.

So my recommendation for partitioning:

  • Boot partition, 300 MB, first partition of your disk (e.g. /dev/sda1), mounted at “/boot”
  • All the rest of the disk goes into one large LVM physical volume, second partition of your disk (e.g. /dev/sda2)
    • LVM volume group consisting of that one physical volume
      • LVM logical volume for “/”, 20 GB, formatted as ext4
      • LVM logical volume for “/tmp”, 5 GB, formatted as ext4
      • LVM logical volume for “/var/vmail”, formatted as ext4, as much space for mailboxes as you want to start with

LVM is very flexible. You can enlarge your root partition or “/var/vmail”. You can even add another physical disk and join it into the volume group to get more space. So just start small.

The Debian installer helps you set up LVM. In a nutshell these are the major steps:

  • Partitioning method: “Manual”
  • Select your disk
  • Create a new partition table if you get asked
  • Create a new partition of “max” size as a Primary partition
  • Set the partition to “Use as: physical volume for LVM”
  • Choose “Configure the Logical Volume Manager”
  • Create a volume group (call it “vg0” if you like)
  • Select the partition you created before (e.g. /dev/sda1)
  • Create the logical volumes for “root”, “tmp” and “mail”.
  • Edit each LV. Set its type to “ext4”. Set the mount points to
    • / for root
    • /tmp for tmp
    • /var/vmail for mail
  • Do not add swap space – your server will need very little RAM. You will get asked if you are serious. Yes, you are.

Write the changes to disk and continue with the rest of the installation. Just make sure that you install the “SSH server” component so that you can login from remote after the installation.

2 thoughts on “Installing Debian”

  1. For those using UEFI machines, it may be easier to begin with a guided partitioning to get the EFI partition set up.

  2. hey Cris, looks like there is a mistake on this part
    “Your hosting company does not offer Debian Bullseye yet but just Debian Bullseye? ”
    just wanna point that out.
    I’ve bin using your guide for a while and works pretty well even with ubuntu lol.
    thanks for this amazing resource.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top