How To Install Debian 12 on Hetzner Root Server

Debian 12(Bookworm) is the latest stable release of Debian that comes with a lot more software than its predecessor bullseye. If you’re interested in the installation of Debian 12 on Hetzner Root Server then this article is prepared for you. Hetzner Cloud provides dedicated server offering that gives you full access and control to configure the server to your liking. Visit Hetzner Online GmbH to see Server auctions for dedicated server hardware at a very competitive rates payable monthly.

We have a dedicated server with the following hardware specifications.

CPU: Intel(R) Xeon(R) CPU E5-1650 v3 @ 3.50GHz (Cores 12)
Memory: 256GB RAM
Disk: 2 x 480GB SSD
Network: 1Gbit
IPV4 Addresses: 1 x IPV4 public address

Every root server you order from Hetzner comes with a single IPv4 public IP address. But extra public IP addresses are available on demand.

1) Order dedicated server

Visit https://www.hetzner.com/sb and search for a server. You can filter search results by Price, Location, CPU, Memory, Drives, e.t.c.

2) Enter Rescue Mode

Once your order is complete, login and access Hetzner root server console then navigate to Main functions > Servers > Server Label > Rescue section to boot your server in rescue mode.

Select Linux operating system and appropriate architecture for your CPU. Choose public key or password authentication method then activate rescue system.

Reboot the server under Reset section to use rescue system.

3) Create installation configuration – used with installimage

After the server is rebooted ssh into it using root username with password / key authentication option.

$ ssh root@ServerIP
Linux rescue 6.5.5 #1 SMP Mon Sep 25 03:07:50 UTC 2023 x86_64

-------------------------------------------------------------------------------------------------------------------------

  Welcome to the Hetzner Rescue System.

  This Rescue System is based on Debian GNU/Linux 12 (bookworm) with a custom kernel.
  You can install software like you would in a normal system.

  To install a new operating system from one of our prebuilt images, run 'installimage' and follow the instructions.

  Important note: Any data that was not written to the disks will be lost during a reboot.

  For additional information, check the following resources:
    Rescue System:           https://docs.hetzner.com/robot/dedicated-server/troubleshooting/hetzner-rescue-system
    Installimage:            https://docs.hetzner.com/robot/dedicated-server/operating-systems/installimage
    Install custom software: https://docs.hetzner.com/robot/dedicated-server/operating-systems/installing-custom-images
    other articles:          https://docs.hetzner.com/robot

-------------------------------------------------------------------------------------------------------------------------

Rescue System up since 2023-10-09 11:21 +02:00

Hardware data:

   CPU1: Intel(R) Xeon(R) CPU E5-1650 v3 @ 3.50GHz (Cores 12)
   Memory:  257647 MB
   Disk /dev/sda: 480 GB (=> 447 GiB) doesn't contain a valid partition table
   Disk /dev/sdb: 480 GB (=> 447 GiB) doesn't contain a valid partition table
   Total capacity 894 GiB with 2 Disks

Network data:
   eth0  LINK: yes
         MAC:  xxxxxx
         IP:   yyyyyy
         IPv6: zzzzzz
         Intel(R) Gigabit Ethernet Network Driver

From the output we can confirm the server has two disks @480GB.

Disk /dev/sda: 480 GB (=> 447 GiB) doesn't contain a valid partition table
Disk /dev/sdb: 480 GB (=> 447 GiB) doesn't contain a valid partition table

We’ll configure them in non-redundant RAID 0 configuration. Start by creating installer configuration file.

vim install-config.txt

Modify sample configuration parameters provided below match your installation requirements.

# Define disks to be used
DRIVE1 /dev/sda
DRIVE2 /dev/sdb

# Enable Raid 0
SWRAID 1
SWRAIDLEVEL 1 # Use 1 for Raid 1, 0 for no raid
BOOTLOADER grub
HOSTNAME deb12.example.com # Set correct hostname
PART /boot ext4 512M
#PART  /boot/efi  esp    256M       #Only needed in UEFI mode, if you get failed install, try enable it
PART lvm vg0 all
LV vg0 root / ext4 50G
LV vg0 swap swap swap 8G
LV vg0 var /var  ext4  300G
# List images with ls /root/.oldroot/nfs/install/../images
IMAGE /root/images/Debian-bookworm-latest-amd64-base.tar.gz

Configure your own partitioning scheme depending on storage hardware and usable space.

4) Install Debian on Hetzner root server

After creating your custom configurations apply to install Debian 12 Linux system.

# installimage -a -c install-config.txt

Installation should begin immediately.

Found AUTOSETUP file '/autosetup'
Running unattended installimage installation ...

DRIVE1 /dev/sda
DRIVE2 /dev/sdb
SWRAID 1
SWRAIDLEVEL 1 # Use 1 for Raid 1, 0 for no raid
BOOTLOADER grub
HOSTNAME myrootserver.computingforgeeks.com
PART /boot ext3 512M
PART lvm vg0 all
LV vg0 root / ext4 50G
LV vg0 swap swap swap 8G
LV vg0 var /var  ext4  300G
IMAGE /root/.oldroot/nfs/install/../images/Debian-1201-bookworm-amd64-base.tar.gz

WARNING:
  Starting installation in 20 seconds ...
  Press X to continue immediately ...
  Installation will DELETE ALL DATA ON DISK(s)!
  Press CTRL-C to abort now!

The installation is purely automated and no user input is required post configuration generation.

Hetzner Online GmbH - installimage

  Your server will be installed now, this will take some minutes
             You can abort at any time with CTRL+C ...

         :  Reading configuration                           done
         :  Loading image file variables                    done
         :  Loading debian specific functions               done
   1/17  :  Deleting partitions                             done
   2/17  :  Test partition size                             done
   3/17  :  Creating partitions and /etc/fstab              done
   4/17  :  Creating software RAID level 0                  done
   5/17  :  Creating LVM volumes                            done
   6/17  :  Formatting partitions
         :    formatting /dev/md/0 with ext4                done
         :    formatting /dev/vg0/root with ext4            done
         :    formatting /dev/vg0/swap with swap            done
         :    formatting /dev/vg0/var with ext4             done
   7/17  :  Mounting partitions                             done
   8/17  :  Sync time via ntp                               done
         :  Importing public key for image validation       done
   9/17  :  Validating image before starting extraction     done
  10/17  :  Extracting image (local)                        done
  11/17  :  Setting up network config                       done
  12/17  :  Executing additional commands
         :    Setting hostname                              done
         :    Generating new SSH keys                       done
         :    Generating mdadm config                       done
         :    Generating ramdisk                            done
         :    Generating ntp config                         done
  13/17  :  Setting up miscellaneous files                  done
  14/17  :  Configuring authentication
         :    Fetching SSH keys                             done
         :    Disabling root password                       done
         :    Disabling SSH root login without password     done
         :    Copying SSH keys                              done
  15/17  :  Installing bootloader grub                      done
  16/17  :  Running some debian specific functions          done
  17/17  :  Clearing log files                              done

                  INSTALLATION COMPLETE
   You can now reboot and log in to your new system with the
 same credentials that you used to log into the rescue system.

Once Debian 12 is installed reboot the server to start using it.

# shutdown -r now

Remote access via SSH is possible with the Public IP address provisioned for the server.

$ ssh root@serverip
Enter passphrase for key '/Users/jmutai/.ssh/id_rsa':
Linux pve01 6.2.16-15-pve #1 SMP PREEMPT_DYNAMIC PMX 6.2.16-15 (2023-09-28T13:53Z) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

Disk partitioning scheme and LVM partitions can be checked using commands shared below.

# lsblk
NAME           MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda              8:0    0 447.1G  0 disk
├─sda1           8:1    0   512M  0 part
│ └─md0          9:0    0   511M  0 raid1 /boot
└─sda2           8:2    0 446.6G  0 part
  └─md1          9:1    0   893G  0 raid0
    ├─vg0-root 253:0    0    50G  0 lvm   /
    ├─vg0-swap 253:1    0     8G  0 lvm   [SWAP]
    └─vg0-var  253:2    0   300G  0 lvm   /var
sdb              8:16   0 447.1G  0 disk
├─sdb1           8:17   0   512M  0 part
│ └─md0          9:0    0   511M  0 raid1 /boot
└─sdb2           8:18   0 446.6G  0 part
  └─md1          9:1    0   893G  0 raid0
    ├─vg0-root 253:0    0    50G  0 lvm   /
    ├─vg0-swap 253:1    0     8G  0 lvm   [SWAP]
    └─vg0-var  253:2    0   300G  0 lvm   /var

# pvs
  PV         VG  Fmt  Attr PSize   PFree
  /dev/md1   vg0 lvm2 a--  893.00g 535.00g

# vgs
  VG  #PV #LV #SN Attr   VSize   VFree
  vg0   1   3   0 wz--n- 893.00g 535.00g

# lvs
  LV   VG  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root vg0 -wi-ao----  50.00g
  swap vg0 -wi-ao----   8.00g
  var  vg0 -wi-ao---- 300.00g

It’s easy to extend an LVM from available space in the Volume Group. In this example we are adding extra 50GB to /dev/vg0/var Logical Volume.

# lvextend -r -L +50G /dev/vg0/vg0

Confirm Debian successful installation by querying OS release info:

root@proxmox ~ # cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Block rpcbind port 111 which is enabled by default.

iptables -A INPUT -p tcp -m tcp --dport 111 -j DROP
iptables -A INPUT -p udp -m udp --dport 111 -j DROP
sudo /sbin/iptables-save

You can optionally disable the service completely.

sudo systemctl disable --now rpcbind rpcbind.socket

Upgrade your system and update all installed packages.

apt update && apt -y full-upgrade
apt install wget vim sudo bash-completion
[ -f /var/run/reboot-required ] && reboot -f

If you need to install Proxmox VE check out the following article.

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Leave a Comment

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

Related Post

There is peace on earth for him who sends good-will to men. – Florence Scovel The CompTIA Security+ (SY0-701) certification […]

Node.js is a versatile programming language that uses Chrome’s V8 JavaScript engine to provide a JavaScript runtime environment. It Is […]

Make 2025 the year you enjoy high-quality music without any annoying wires getting in the way. In fact, you can […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.