Install Debian Bullseye on your server

Option 1: Get a server with Debian Bullseye 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 Buster

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

deb http://deb.debian.org/debian bullseye main
deb http://deb.debian.org/debian bullseye-updates main
deb http://security.debian.org/debian-security bullseye-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 Bullseye 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. 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.

5 thoughts on “Install Debian Bullseye on your server”

  1. Can I get some clarification of the partitioning of the drive. I have not been able to get grub installed as I understand the partitions to be setup here.

    1. Christoph Haas

      I was taught 25 years ago that swap (and virtual memory) was invented when RAM was crazy expensive. And the prices weren’t that bad back then already. In my humble opinion swap is just an artifact of the early ages of computing. If your computer is so short on RAM that it needs the swap then your system needs more RAM. Otherwise you are close to a very dangerous spiral-down effect. If the system gets overloaded and needs the swap to survive then it will become even slower. And in most cases you can see the system die slowly. The only upside may be that the Linux kernel will try to move unused parts of the software into swap which might help with a few MB of RAM.

      The only valid reason to have swap is using a laptop and needing it for suspend mode.

      But that’s just me. And apparently the Debian installer disagrees with me. 🙂

  2. Matheus Rubens Delmaschio Borges

    Why don’t use EFI partition?

    obs: I don’t know if it is a stupid question because I’m a begginer.

  3. Peter Rohrer

    I would recommend to make /boot a bit larger, Debian seems to default to 500MB for new installations, and I have run into space problems on older (upgraded) installations with an 250MB boot-partition during kernel-updates.

Leave a Reply

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

Scroll to Top