Installing Debian 11 on a PM or KVM VM

Last updated: 03/11/2021

Introduction

This page describes the procedure for installing Debian 11 on a physical machine (PM) or a KVM-based VM. The procedure is deliberately kept as short as possible, with most of the work being offloaded to PCMS. Other pages on this website explain how to configure server applications.

Prologue for a physical machine

  1. Prepare DNS entries.
  2. Perform a full backup! Yes, really.
  3. Prepare Debian 11 amd64 Netinst ISO image (any point version ok) on USB stick
  4. If installing to a PM that supports UEFI then enable UEFI boot mode and disable legacy boot mode. More specifically:
    • torchio, fiori:
      1. disable secure boot
      2. disable quickboot/fastboot
      3. disable Intel Smart Response Technology (SRT)
    • ragu, sugo:
      1. press ESC (‘Startmenü’) and F10 (‘BIOS Setup’)
      2. Set Datei–>Standard-Setup–>Werkstinst. als Standard speichern
      3. Set Datei–>Standard übernehmen und schließen
      4. Press ESC and F10.
      5. Set Sicherheit–>Systemsicherheit–>Virtualisierungstechnologie: Aktiviert
      6. Set Erweitert–>Systemstart-Optionen–>POST-Meldungen: Aktiviert
      7. Set Erweitert–>Systemstart-Optionen–>POST Verzögerung: 5
    • halusky:
      1. does not support UEFI
  5. If installing to a VM then create the perfect VM for Debian 11 and add any additional NICs necessary.
  6. An internet connection is required.

Prologue for a virtual machine

Features of this “perfect” VM are:

  1. libvirt-managed volume or DRBD volume
  2. use of UEFI firmware
  3. a graphical console capable of running X11 (provided by the mouse, keyboard, Spice-based display and QXL video)
  4. USB device redirection (allowing a VM to access USB devices attached to where virt-viewer is run from) (provided by a suitable USB controller, USB redirector and one Spice channel per concurrently accesses USB device)
  5. a serial console, which is adequate for a typical server (provided by the serial interface)
  6. a lot of unwanted hardware can be stripped from the VM
  7. Addition of CD-ROM in order to install from ISO images
  8. support for nested KVM-based VMs

The VM is created using scripts.

  1. If not done already then download the virttools module:
    mkdir -p ~/opt
    svn co https://svn.pasta.freemyip.com/main/virttools/trunk ~/opt/virttools
  2. Decide on the volume names: if the VM will have only one disk then <vol-name> should probably be <vm-name>. If the VM will have more than one disk then the <vol-name>s should probably be something like <vm-name>_<one-word-description> or alternatively <vm-name>_disk1, <vm-name>_disk2, etc.
  3. The page that led you here should have specified volume and container creation commands; run them on one node of the virtualisation cluster now.
  4. Start the container with:
    virsh start <container-name>
    
  5. Connect to its console.

Procedure

  1. Boot the media
  2. halusky: leave the selector bar on ‘Graphical install’ and press <ENTER> (failure to do this will cause halusky to reboot or show only screen flicker)
    not halusky: move the selector bar to ‘Install’ (not ‘Graphical install’) and press <ENTER>.
  3. Accept all defaults except as noted below.
  4. At the ‘Configure the keyboard’ window:
    1. delguine:, when prompted ‘Keymap to use:’, select ‘British English’.
  5. THIS DID NOT HAPPEN YET … ONCE ALL HOSTS INSTALLED DELETE THIS: At the ‘Detect network hardware’ window:
    1. if prompted ‘Load missing firmware from removable media?’, select ‘No’.
  6. At the ‘Configure the network’ window:
    1. if prompted ‘Primary network inteface:’, select the primary network interface (probably the first one)
    2. if prompted ‘Hostname:’, enter the system’s hostname.
    3. if prompted ‘IP address:’, enter the system’s IP address, netmask, gateway and DNS server.
  7. At the ‘Set up users and passwords’ window:
    1. , when prompted ‘Root password:’, press <ESC> to get to the main menu and select ‘Configure the clock’ (i.e. skip the ‘Set up users and passwords’ step).
  8. At the ‘Partition disks’ window:
    1. Select ‘Manual’.
    2. If the system has UEFI enabled, and if it appears, when prompted ‘Force UEFI installation?’, select ‘Yes’.
    3. if the system supports UEFI:
      1. create a primary partition of size ‘576716800B’ (i.e. 550MiB; this article explains why we specify the size in bytes)  at the beginning of the first disk to be used for EFI System Partition.
      2. fiori, torchio, pestaroli, testaroli: create a primary partition of size ‘576716800B’ (i.e. 550MiB; this article explains why we specify the size in bytes)  at the beginning of the second disk not to be used
    4. create a primary partition of size ‘1073741824B’ (i.e. 1024MiB; this article explains why we specify the size in bytes)  at  the beginning of the first disk to be used for ext4 filesystem mounted on /boot
    5. fiori, torchio, pestaroli, testaroli: create a primary partition of size ‘1073741824B’ (i.e. 1024MiB; this article explains why we specify the size in bytes)  at the beginning of the second disk not to be used
    6. fiori, torchio, pestaroli, testaroli:
      1. create a primary partition using all remaining space on the first disk to be used for physical volume for RAID
      2. create a primary partition using all remaining space on the second disk to be used for physical volume for RAID
      3. select ‘Configure software RAID’, allow the partition manager to write the just-defined partitions to disk
      4. when prompted ‘Software RAID configuration actions’, select ‘Create MD device’.
      5. when prompted ‘Software RAID device type:’, select ‘RAID0’.
      6. when prompted ‘Activate devices for the RAID0 array:’, select disks /dev/*da3 and /dev/*db3 and select ‘Continue’.
      7. when prompted ‘Write the changes to the storage devices and configure RAID?’, select ‘Yes’.
      8. when prompted ‘Software RAID configuration actions’, select ‘Finish’.
      9. select the RAID0 device and use it for physical volume for LVM
      10. Select ‘Configure the Logical Volume Manager’, allow the partition manager to write the just-defined partitions to disk
      11. Create VG vg0 on md0
    7. NOT fiori, torchio, pestaroli, testaroli:
      1. create a primary partition using all remaining space on the first disk to be use for physical volume for LVM
      2. Select ‘Configure the Logical Volume Manager’, allow the partition manager to write the just-defined partitions to disk
    8. Create LV root on vg0 of size ‘26843545600B’ (i.e. 25GiB; this article explains why we specify the size in bytes)
    9. Select ‘Finish’ to return to the Manual partitioner.
    10. Use LV root for ext4 filesystem mounted on /
    11. Save the changes and when warned about the absence of a swap partition continue anyway.
  9. At the ‘Software selection’ window:
    1. when prompted ‘Choose software to install:’, deselect everything.
  10. At the ‘Finish the installation’ window:
    1. press <ALT-F2>, activate the terminal by pressing <ENTER> and run:
      chroot /target
      passwd root           #  follow prompts to set password
      exit
      exit

      and then press <ALT-F1> to return to the installer.

  11. If installing a VM then, as the system reboots:
    1. power off
    2. change the boot order to boot from disk
    3. power on
  12. If you modified then kernel command line above (e.g. with nomodeset) then do the same as the system boots up again.
  13. Log in as root.
  14. The list of packages in a basic Debian 11 PM or KVM VM and the list of packages in a Debian 11 LXC container differ slightly. Some differences are to be expected (e.g. containers don’t install kernels) but we can minimise other differences, and thereby approach a common package list, by adding and removing just a couple of packages:
    apt -y --no-install-recommends install openssh-server
    apt -y --purge autoremove task-english libreadline8
  15. Install and run PCMS.

      See also