Install Debian Stretch on your server

If you rented a virtual server at your favorite hosting company then you already have a ready installation of Debian Stretch. If you have a chance to change the partitioning scheme then please create a seperate partition for /var/vmail as described below. Otherwise feel free to skip this page →

Basic installation and partitioning

Installing Debian Stretch is easy. 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. If you have trouble with the server you will more likely find help when google’ing for english error messages.

The only part that takes some patience is when it comes to partitioning your disk. When the installation asks how to partition choose “Manual”. Throughout this tutorial you will store your users’ emails in the /var/vmail partition where the actual emails are stored. The MySQL database will live in /var/lib/mysql and is usually pretty small even for a large number of email accounts – so that won’t require a seperate mount point. Log files live in /var/log.

So my recommendation is:

  • / (10 GB, ext4)
  • /tmp (1 GB, ext4, optional but recommended)
  • swap (1 GB)
  • /var/vmail (the remaining space – the more the better, ext4, mounted with the noatime option)

If possible use the logical volume manager (LVM). It gives you a lot of flexibility to move or enlarge the mail partition without interrupting the operation of the server.

Step-by-step installation guide

If you feel uneasy installing Debian then just follow these steps and your installation will be done in a few minutes. After booting from the installation medium you will be greeted by…

ispmail-jessie-install-_01

Always choose ‘English’ as your installation language. As I said it will be easier to get help on the internet if you get stuck.

 

ispmail-jessie-install-_02

Choose your geographical location. This is mostly important for the time zone setting.

ispmail-jessie-install-_03

Choose the keymap that matches the layout of your keyboard.

ispmail-jessie-install-_04

The installer prepares further packages that are needed for the installation process:

ispmail-jessie-install-_05

Some system administrators consider this the most complicated step. Choosing a host name. 🙂

ispmail-jessie-install-_06

The domain of the server is independent from your mail domains. Just choose any of your domains. You should create a DNS record for that name later.

ispmail-jessie-install-_07

Think of a good password for the “root” user. You do not have to fear that someone from the internet will be able to access that account. SSH is by default configured to only allow root access from the console or using public key authentication.

ispmail-jessie-install-_08

Debian has adopted Ubuntu’s habit to avoid direct SSH logins as “root”. So you are asked for the realname, username and password of an aditional user. I will call this user “johndoe” in this guide but of course you can call it anything you like.

ispmail-jessie-install-_09

Depending on the country you chose you may get asked which time zone you are in.

ispmail-jessie-install-_10

Now it is time to partition your disk. Choose “Manual”.

ispmail-jessie-install-_11

Select the disk you want to use. In my example I just have one disk called “sda”:

ispmail-jessie-install-_12

On a fresh system there are no partitions. So the installer will ask you to create a new partition table:

ispmail-jessie-install-_13

Select the line reading “FREE SPACE” and press Enter:

ispmail-jessie-install-_14

Create a new partition:

ispmail-jessie-install-_15

The first partition is used for the actual operating system. Make it 10 GB:

ispmail-jessie-install-_16

The type is “Primary”. (Historically you can have four primary partitions. If you need more then the first three are primary and further partitions are logical. We just need four partitions so you can create all of type “primary”.)

ispmail-jessie-install-_17

The new partition will be created at the beginning of the free space:

ispmail-jessie-install-_18

Make sure that the root (“/”) partition is set to bootable.

ispmail-jessie-install-_19

Your first partition is created. Now choose “FREE SPACE” again:

ispmail-jessie-install-_20

Create another new partition…

ispmail-jessie-install-_21

This is the “/tmp” partition. Make it 1 GB large:

ispmail-jessie-install-_22

It is of type “Primary” as usual:

ispmail-jessie-install-_23

…at the beginning of the free space…

ispmail-jessie-install-_24

There are no special settings required. Just choose “/tmp” as themount point and you are done…

ispmail-jessie-install-_25

Again choose “FREE SPACE”…

ispmail-jessie-install-_26

Create another partition for swap space…

ispmail-jessie-install-_27

1 GB is more than enough…

ispmail-jessie-install-_28

The type is “Primary” as usual…

ispmail-jessie-install-_29

…at the beginning of the remaining space…

ispmail-jessie-install-_30

As type choose “swap area”:

ispmail-jessie-install-_31

Now for the final partition in /var/vmail that will later contain the actual emails. We will grant it all the remaining space. So choose “FREE SPACE” one last time…

ispmail-jessie-install-_32

Create a new partition…

ispmail-jessie-install-_33

The installer suggests to use all the remaining space. So press Enter to confirm that…

ispmail-jessie-install-_34

“Primary”…

ispmail-jessie-install-_35

Set the mount point to “/var/vmail” and add the mount option “noatime”. noatime means “no access time”. Without this option a file system will record any access to a file. This is not necessary to operate a mail server and will spare one file system access per email which slightly speeds up the disk access…

ispmail-jessie-install-_36

That’s it. All partitions are now created. Finish the partitioning…

ispmail-jessie-install-_37

The installer shows an overview again. If it looks similar on your screen then choose “Yes”…

ispmail-jessie-install-_38

After the installer created the partitions it will install basic packages and install the base system.

ispmail-jessie-install-_39

Depending on your geographical location you will get asked which download server you would like to use. Usually you can just confirm the suggested default…

ispmail-jessie-install-_40

Unless you need a proxy to access the download servers on the internet you can leave this blank…

ispmail-jessie-install-_41

The installer will get information from the Debian download server and download further packages…

ispmail-jessie-install-_42

Participating in the package survey (also known as popcon) is purely voluntary. It records which packages you install to help Debian developers assess which packages are commonly used and deserver special attention…

ispmail-jessie-install-_43

Now you are getting asked which groups of packages to install. All you need is an “SSH server” (to be able to log in to the system later) and the “standard utilities”…

ispmail-jessie-install-_44

Your selected packages are getting downloaded and installed…

ispmail-jessie-install-_45

To make your system bootable the installer will write a boot loader into the beginning of your first disk…

ispmail-jessie-install-_46

The choice depends on your system. Usually it is the first disk that you use to install the boot loader…

ispmail-jessie-install-_47

Nearly done…

ispmail-jessie-install-_48

That is it. The installation is done and by selecting “Continue” your system will reboot.

ispmail-jessie-install-_49

11 thoughts on “Install Debian Stretch on your server”

  1. What will be the drawbacks when using a “standard” partitioning scheme, that is 1 GB swap and rest to / ? I ask because I have an existing server which is partitioned that way and has no LVM for easy resizing…

    1. Andreas Renner

      I think the reason for this partitioning scheme (especially the extra partition for /var/mail) is the fact, that he sets noatime option for this partion. As mentioned in the tutorial:

      ‘…noatime means “no access time”. Without this option a file system will record any access to a file. This is not necessary to operate a mail server and will spare one file system access per email which slightly speeds up the disk access…’

      So in my opinion that’s quite optional and not a must…

    2. Christoph Haas

      @Alad: Just keep it that way. Using LVM is nice to create snapshots for backup. Or to resize partitions. Or to move logical volumes across physical volumes in case you migrate to larger RAIDs. Do not worry.

  2. Perhaps it should be noted that the partitioning scheme where GPT is involved (many desktop computers manufactured in the last five years support UEFI) is somewhat different. GPT boots from a “EFI System” partition and then onto the root Linux partition. That being the case, the “Bootable flag” does NOT get set on the root partition.

    I usually opt for the automatic partitioning, delete all the Linux partitions and then re-add them as described. GPT puts a couple of sectors of free space up front and then the EFI System partition otherwise everything looks familiar.

  3. Hi, I have a question, would it be advisable to create a “/usr/local” partition if you plan to install different services that are not part of Debian?

  4. Rostislav Pokorný

    If I have 1 TB disk and 8 GB of RAM space, it’s still good to use 10GB for system, 1GB for SWAP, and 1GB for Temp? And other space (980 GB) for mail?

  5. I saw no mention of what architecture to install. I installed i386. Then when I tried to install rspamd I found it does not seem to be available for i386. Or did I miss something?

Leave a Reply

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

Scroll to Top