How to Create a RHEL 8 Image for Hetzner Root Servers

7 minute read



In this article I will explain how to create your own custom RHEL 8 image for hetzner root servers. Hetzner offers new and used physical servers on a per/month basis ( They offer extremely competitive pricing. These servers are perfect for demo or lab environments where you are operating your own platform and want it running 24/7!

Hetzner unfortunately does not offer RHEL images however, does provide a means for bringing your own image. A colleague of mine, Ingo Boernig, already shared a blog on how to do this for RHEL 7.5. This article with cover RHEL 8.0.

Install RHEL 8 in a VM

Download RHEL 8 ISO DVD from Using KVM virt-manager (or another hypervisor) install RHEL 8 in a VM.


Once the VM boots follow the installation and use defaults. Select minimal server from the software selection. Also configure network to boot using DHCP.


Prepare RHEL 8 VM for Hetzner

Log into the VM using ssh or console.

Hetzner only supports one boot kernel. As such we will remove the rescue kernel.

# rm /boot/vmlinuz-0-rescue-adcc72dfe3ed4c049ffff0ec950a90d9
# rm /boot/initramfs-0-rescue-adcc72dfe3ed4c049ffff0ec950a90d9.img

Hetzner creates a ram disk and uses the dracut tool. It expects dracut to be installed under /sbin. This is not the case with RHEL 8 so we will add a symlink.

# ln -s /usr/bin/dracut /sbin/dracut

Finally create a tar zip of the RHEL 8 OS. The image needs to be called CentOS-75-el-x86_64-minimal.tar.xz because Hetzner is expecting certain image names but I assure you this will be RHEL 8.

# tar cJvf CentOS-75-el-x86_64-minimal.tar.xz --exclude=/dev \
--exclude=/proc --exclude=/sys --exclude=/CentOS-75-el-x86_64-minimal.tar.xz /

Deploy Image on Hetzner Server

In order to install OS or repair it you need to get into Hetner server rescue mode.




Using secure copy, upload the image to the Hetzner server /root directory.

# scp CentOS-75-el-x86_64-minimal.tar.xz root@hetzner_ip:/root

Log into your Hetzner server using your ssh key. You should be placed into rescue mode.

Create a Hetzner configuration and use your custom image

root@rescue# vi config.txt

DRIVE1 /dev/sda 
DRIVE2 /dev/sdb 
HOSTNAME keithcloud.lab 
PART /boot ext3 512M 
PART lvm vg0 150G 

LV vg0 root / ext4 50G 
LV vg0 swap swap swap 8G 
LV vg0 var /var ext4 10G 
LV vg0 tmp /tmp ext4 30G

IMAGE /root/CentOS-75-el-x86_64-minimal.tar.xz

Install Image on root server.

root@rescue# installimage -a -c config.txt

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 centos specific functions done 
1/18 : Deleting partitions done 
2/18 : Test partition size done 
3/18 : Creating partitions and /etc/fstab done 
4/18 : Creating software RAID level 0 done 
5/18 : Creating LVM volumes done 
6/18 : Formatting partitions
: formatting /dev/md/0 with ext3 done 
: formatting /dev/vg0/root with ext4 done 
: formatting /dev/vg0/swap with swap done 
: formatting /dev/vg0/var with ext4 done 
: formatting /dev/vg0/tmp with ext4 done 
: formatting /dev/vg0/home with ext4 done 
7/18 : Mounting partitions done 
8/18 : Sync time via ntp done 
9/18 : Downloading image (http) done 
: Importing public key for image validation done 
10/18 : Validating image before starting extraction warn 
: No detached signature file found!
11/18 : Extracting image (http) done 
12/18 : Setting up network config done 
13/18 : Executing additional commands
: Setting hostname done 
: Generating new SSH keys done 
: Generating mdadm config done 
: Generating ramdisk done 
: Generating ntp config done 
14/18 : Setting up miscellaneous files done 
15/18 : Configuring authentication
: Fetching SSH keys done 
: Disabling root password done 
: Disabling SSH root login without password done 
: Copying SSH keys done 
16/18 : Installing bootloader grub done 
17/18 : Running some centos specific functions failed

An error occured while installing the new system!
See the debug file /root/debug.txt for details.

Note: You will see an error because Hetzner will want perform a dnf update as last step. On a RHEL image this won't work as you haven't setup a subscription. This error is safe to ignore. As long as you got to step 17 you are fine.

Reboot root server.

root@rescue# reboot now

Log back into Hetzner root server and verify RHEL version.

[root@keithcloud ~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.0 (Ootpa)


In this article we showed how to build a custom RHEL 8 image for Hetzner servers. Feedback is always welcome so please don't be shy.

Happy Clouding!

(c) 2019 Keith Tenzer