{"id":63,"date":"2018-07-03T10:44:57","date_gmt":"2018-07-03T10:44:57","guid":{"rendered":"http:\/\/boernig.de\/wordpress\/?p=63"},"modified":"2018-07-03T10:44:57","modified_gmt":"2018-07-03T10:44:57","slug":"running-rhel-on-hetzner-hosted-servers","status":"publish","type":"post","link":"http:\/\/boernig.de\/wordpress\/2018\/07\/03\/running-rhel-on-hetzner-hosted-servers\/","title":{"rendered":"Running RHEL on Hetzner hosted servers"},"content":{"rendered":"<p>Hetzner (http:\/\/www.hetzner.de) is a quite popular and affordable server hoster in Germany.<\/p>\n<p>Unfortunately, their automated install procedure supports only Debian, Ubuntu, OpenSUSE or CentOS distributions. As a Red Hat Developer (and Employee) I want to run a real RHEL operating system.<\/p>\n<p>To prepare for the automated installation with the &#8220;installimage&#8221; tool, we need to prepare an operating system image.<\/p>\n<p>On a local virtual machine, we start with\u00a0 installing a minimal RHEL server. The following kickstart file can be used for this:<\/p>\n<pre>#version=DEVEL\r\n# System authorization information\r\nauth --enableshadow --passalgo=sha512\r\nrepo --name=\"Server-HighAvailability\" --baseurl=file:\/\/\/run\/install\/repo\/addons\/HighAvailability\r\nrepo --name=\"Server-ResilientStorage\" --baseurl=file:\/\/\/run\/install\/repo\/addons\/ResilientStorage\r\n\r\n# Use CDROM installation media\r\ncdrom\r\n\r\n# Use graphical install\r\ngraphical\r\n\r\n# Run the Setup Agent on first boot\r\nfirstboot --enable\r\nignoredisk --only-use=vda\r\n\r\n# Keyboard layouts\r\nkeyboard --vckeymap=de-nodeadkeys --xlayouts='de (nodeadkeys)','us'\r\n\r\n# System language\r\nlang en_US.UTF-8\r\n\r\n# Network information\r\nnetwork \u00a0--bootproto=dhcp --device=eth0 --ipv6=auto --activate\r\nnetwork \u00a0--hostname=localhost.localdomain\r\n\r\n# Root password\r\nrootpw --iscrypted &lt;hash&gt;\r\n\r\n# System services\r\nservices --enabled=\"chronyd\"\r\n\r\n# System timezone\r\ntimezone Europe\/Berlin --isUtc\r\n\r\n# System bootloader configuration\r\nbootloader --append=\" crashkernel=auto\" --location=mbr --boot-drive=vda\r\nautopart --type=lvm\r\n\r\n# Partition clearing information\r\nclearpart --none --initlabel\r\n\r\n%packages\r\n@^minimal\r\n@core\r\nchrony\r\nkexec-tools\r\n%end\r\n\r\n%addon com_redhat_kdump --enable --reserve-mb='auto'\r\n%end\r\n\r\n%anaconda\r\npwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty\r\npwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok\r\npwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty\r\n%end<\/pre>\n<p>Then we boot up the server and log in to change same settings:<\/p>\n<ol>\n<li>The Hetzner tool does only tolerate one kernel in boot, so we need to remove the rescue kernel:\n<pre>rm \/boot\/vmlinuz-0-rescue-adcc72dfe3ed4c049ffff0ec950a90d9\r\nrm \/boot\/initramfs-0-rescue-adcc72dfe3ed4c049ffff0ec950a90d9.img<\/pre>\n<\/li>\n<li>\u00a0We need to install the mdadm\u00a0 utitlity. We could have done it via kickstart, but sometimes you get the information too late ;-):\n<pre>subscription-manager register --auto-attach\r\nyum install -y mdadm\r\nsubscription-manager unregister<\/pre>\n<\/li>\n<li>Now we can create the image file using tar. Note that we have to exclude the directories \/proc \/sys and \/dev (and the image itsself). Note that we need to name the image &#8220;CentOS&#8221; and also the version &#8220;7.5&#8221; in this case needs to be coded into the filename.\n<pre>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<\/pre>\n<\/li>\n<\/ol>\n<p>Hetzners &#8220;installimage&#8221; tool will then use these names to decide how the system is adminitrated. &#8220;Red Hat&#8221; is not known here&#8230; Their documentation can be found here:<\/p>\n<p><a href=\"https:\/\/wiki.hetzner.de\/index.php\/Eigene_Images_installieren\">https:\/\/wiki.hetzner.de\/index.php\/Eigene_Images_installieren<\/a><\/p>\n<p>This image now has to retrieved from the VM and saved on a publicly available web server. In my case:<\/p>\n<p><a href=\"http:\/\/boernig.de\/CentOS-75-el-x86_64-minimal.tar.xz\">http:\/\/boernig.de\/CentOS-75-el-x86_64-minimal.tar.xz<\/a><\/p>\n<p>Now the Hetzner rescue system can be started and one can log in into system and start the installimage-tool.<\/p>\n<p>You have to chose &#8220;Custom-image&#8221; in the interactive mode. When you are in the editor choose your disk layout as you like for your purpose, but close the file with the &#8220;IMAGE&#8221; parameter which points tor your custom build image:<\/p>\n<pre>IMAGE\u00a0http:\/\/boernig.de\/CentOS-75-el-x86_64-minimal.tar.xz<\/pre>\n<p>Then you can save&amp;exit and the automatic installation starts. Do not worry, if the you run into an error, for me the installation failed on the last step: The script tried to install updates, but since the system is not registered yet, this was not possible.<\/p>\n<p>However, the image is there, the kernel in place, grub installed and the network and ssh-keys are set! Just use reboot to boot into the image and you can login!<\/p>\n<p>Don&#8217;t forget to disable PasswortLogins in \/etc\/ssh\/sshd_config!<\/p>\n<p>Have fun!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hetzner (http:\/\/www.hetzner.de) is a quite popular and affordable server hoster in Germany. Unfortunately, their automated install procedure supports only Debian, Ubuntu, OpenSUSE or CentOS distributions. As a Red Hat Developer (and Employee) I want to run a real RHEL operating system. To prepare for the automated installation with the &#8220;installimage&#8221; tool, we need to prepare &hellip; <a href=\"http:\/\/boernig.de\/wordpress\/2018\/07\/03\/running-rhel-on-hetzner-hosted-servers\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Running RHEL on Hetzner hosted servers&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/boernig.de\/wordpress\/wp-json\/wp\/v2\/posts\/63"}],"collection":[{"href":"http:\/\/boernig.de\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/boernig.de\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/boernig.de\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/boernig.de\/wordpress\/wp-json\/wp\/v2\/comments?post=63"}],"version-history":[{"count":2,"href":"http:\/\/boernig.de\/wordpress\/wp-json\/wp\/v2\/posts\/63\/revisions"}],"predecessor-version":[{"id":65,"href":"http:\/\/boernig.de\/wordpress\/wp-json\/wp\/v2\/posts\/63\/revisions\/65"}],"wp:attachment":[{"href":"http:\/\/boernig.de\/wordpress\/wp-json\/wp\/v2\/media?parent=63"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/boernig.de\/wordpress\/wp-json\/wp\/v2\/categories?post=63"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/boernig.de\/wordpress\/wp-json\/wp\/v2\/tags?post=63"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}