Skip to content

Instantly share code, notes, and snippets.

@vookimedlo
Last active December 18, 2020 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vookimedlo/ac63ccb558db3af13d31080419a73b1e to your computer and use it in GitHub Desktop.
Save vookimedlo/ac63ccb558db3af13d31080419a73b1e to your computer and use it in GitHub Desktop.
How to install a Debian Testing from the scratch on the Linode server.

Linode

Custom Debian Installation

Erase generated configurations

  • Create a Linode instance [linode cloud dashboard]
  • Remove all disk [linode cloud dashboard]
  • Remove all configurations [linode cloud dashboard]

Disks

  • Create 2GBs sized RAW disk, label boot [linode cloud dashboard]
  • Create 2GBs sized RAW disk, label installer [linode cloud dashboard]

Configurations

  • Installer profile [linode cloud dashboard]
    • Label: Installer.
    • Kernel: Direct Disk.
    • /dev/sda: Boot disk image.
    • /dev/sdb: Installer disk image.
    • root / boot device: Standard /dev/sdb.
  • Boot profile [linode cloud dashboard]
    • Label: Boot.
    • Kernel: Direct Disk.
    • /dev/sda: Boot disk image.
    • root / boot device: Standard /dev/sda.
    • Remove all Filesystem/Boot Helpers.

Install image preparation

  • Boot into Rescue Mode with your Installer disk mounted to /dev/sda, and connect to your Linode using the Lish Console.

  • Place the image to the previously created Installer disk.

    curl http://ftp.debian.org/debian/dists/testing/main/installer-amd64/current/images/netboot/mini.iso | dd of=/dev/sda
    
  • Empty the cache so that you have enough space to unpack and install the image.

    sync; echo 3 > /proc/sys/vm/drop_caches
    

Install distribution

  • Boot into the Installer profile, and connect to your Linode using the GLish Console.
  • Do installation
    • Manually do the disk partitioning and let the installer to devide the /dev/sda according its needs.
    • Do not install any GUI desktops.
    • Install the SSH server.

Lish support

  • Boot into the Boot profile, and connect to your Linode using the GLish Console.

  • Update the following settings in your /etc/default/grub file.

    GRUB_TIMEOUT=10
    GRUB_CMDLINE_LINUX_DEFAULT=""
    GRUB_CMDLINE_LINUX="console=ttyS0,19200n8 net.ifnames=0"
    
  • Re-generate the grub configuration.

    update-grub
    

Network configuration

  • Update the following settings in your /etc/systemd/network/05-eth0.network file.

    [Match]
    Name=eth0
    
    [Network]
    DHCP=yes
    IPv6PrivacyExtensions=false
    
  • Restart the Linode and check that networking works.

Linode compatibility

  • Create a new ext4 disk. The new disk should be large enough to accommodate the root filesystem that was created on your raw disk. You can make this as large as you’d like, but you should leave enough space for a separate swap partition. Name this disk Root. [linode cloud dashboard]

  • Create the second new disk and choose swap for the disk type. The size of this disk will depend upon your needs, but it’s recommended that you make it between 256-512MB to start. Name this disk Swap. [linode cloud dashboard]

  • Create a new configuration profile and it will use the following options:

    Production profile [linode cloud dashboard]

    • Label: Production.
    • Kernel: GRUB 2.
    • /dev/sda: Root disk image.
    • /dev/sdh: Swap disk image.
    • root / boot device: Standard /dev/sda.
    • Remove all Filesystem/Boot Helpers except the Disable updatedb.

Update your fstab

  • You should still be booted into your Boot profile using direct disk boot; if not, boot into it now.

  • Before you update your /etc/fstab file, make sure you know the current root partition of your custom distro. You can use the lsblk command to confirm which partition has / as its mount point:

    root@custom-kvm:~# lsblk
    ...
    └─sda2   8:1    0  7.5G  0 part /
    ...
    
  • Next, update your /etc/fstab file to match the following:

    /dev/sda    /    ext4    noatime,errors=remount-ro   0   1
    /dev/sdb    none swap    sw
    
  • Note that you’re using /dev/sda instead of the sda2 root partition that was identified previously.

Transfer your Root Filesystem to your Ext4 Disk

  • Now that you’ve updated the necessary configuration files, you’re ready to move your root filesystem to the ext4 disk you created previously. To get started, boot your Linode into Rescue Mode with the following disk assignments:

    • Boot disk mounted to /dev/sda.
    • Root disk mounted to /dev/sdb.
  • In Rescue Mode, connect via Lish and transfer your root filesystem from the /dev/sda2 partition to your new ext4 disk:

    dd if=/dev/sda1 of=/dev/sdb bs=1M
    

Grub configuration update

  • Boot your Linode into Rescue Mode with the following disk assignments:

    • Root disk mounted to /dev/sda.
  • Mount all required items.

    mount /dev/sda /mnt
    mount --bind /dev /mnt/dev
    mount --bind /proc /mnt/proc
    mount --bind /sys /mnt/sys
    
  • Re-generate the grub configuration.

    chroot /mnt
    update-grub
    

Final run

Boot your Linode into the Production profile.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment