Downgrading Hetzner Cloud Server to Ubuntu 14.04 LTS
by Thomas Urban
Hetzner is now offering its cloud services promoting quite cheap virtual servers replacing its previous offer of virtual servers CX line. In cloud services there is no installimage support thus running server with Ubuntu 14.04 LTS requires manual installation.
Create Virtual Server
This tutorial does not cover steps required for creating new virtual server in Hetzner Cloud Services in the first place. As a prerequisite you need to create one yourself.
Examine Network Configuration
DHCP autoconfiguration was failing when running Ubuntu 14.04 LTS installer and so you should examine and write down network configuration of your freshly created virtual server. Log into server via SSH and run these commands:
-
ifconfig eth0
is used to show basic IPv4 configuration of NIC eth0. -
route -n
is used to display route configuration. This is pretty essential in case your existing server isn't part of some IP network by means of configuration. -
cat /etc/network/interfaces.d/50-cloud-init.cfg
is used to show the IPv6 configuration. -
cat /etc/resolv.conf
will show nameservers. -
cat ~/.ssh/authorized_keys
isn't related to network configuration but displays your SSH public key used for authentication to be restored afterwards.
Running these commands in an SSH session you should keep this window open until installation of Ubuntu 14.04 LTS has succeeded.
Mount ISO Image
Return to console of Hetzner Cloud Services. Select your server and pick option "ISO-Images" from menu. This list includes ISO images labelled Ubuntu 14.04.05 (amd/netinstall) or similar. Mount that image.
Restart Server
Return to open SSH session and invoke reboot
command.
Don't close the window afterwards!
Install Ubuntu 14.04 LTS
Switch back to console of Hetzner Cloud Services and open server's web console (available by clicking little prompt icon at top of page). This is opening a new browser window providing console access.
Start the installer and choose options as you like. Obey the hints given below.
On Automatic Network Configuration Failing
If installer fails to discover network configuration automatically you need to:
- provide the IP of eth0 as given in output of
ifconfig eth0
invoked before, - provide the network mask of eth0 as given in same output of
ifconfig eth0
, - provide the gateway's IP address as given in output of
route -n
invoked before or omit any gateway information but keep the field empty in case of your input isn't accepted by installer, - provide IP address of at least one of the name servers listed in output of
cat /etc/resolv.conf
.
Completing Installation
On setting up hard disk you might prefer guided installation for using all hard disk or create partitions as you like.
Make sure to install OpenSSH server when asked to choose software modules to be included. Probably enabling any other module here might fail due to requiring network access which isn't complete, yet, in case of having issues with automatic network configuration before.
Unmount ISO images using console of Hetzner Cloud Services when installer has finished. Then reboot into Ubuntu 14.04 LTS.
Fixing Network Configuration
Booting system might take some time due to incomplete network initialization. Log in as regular user created in installer using web console. Open network configuration in editor by invoking sudo nano /etc/network/interfaces
.
On Gateway Rejected by Installer Before
There should be a block of lines indented next to a line reading iface eth0 inet static
. Append these three lines to those existing there using same indentation:
dns-nameservers 213.133.100.100 213.133.98.98 213.133.99.99
up route add 1.2.3.4 dev eth0
up route add default gw 1.2.3.4
Replace 1.2.3.4 with IP address given in output of
route -n
before. You might need to use different IP addresses for name servers as well.
Adding IPv6 Configuration
Check output of cat /etc/network/interfaces.d/50-cloud-init.cfg
for another block including line containing inet6 static
. In our case it reads iface eth0:0 inet6 static
. Appends the whole block starting with line reading auto eth0:0
or similar to file in editor.
Finally save file and reboot the server. This time it shouldn't take much time to boot up.
Test setup by logging in again and invoke a command like ping google.com
. Try ping6 google.com
to check IPv6 configuration, too.
Recover SSH Key
Log into server via SSH as regular user created by installer using password given there.
Using SSH here helps with entering key data using clipboard which isn't available in Hetzner's web console.
Run sudo mkdir -p /root/.ssh
to create folder containing key files. Limit permissions on folder using sudo chmod 0700 /root/.ssh
.
Open editor for entering key using sudo nano /root/.ssh/authorized_keys
. Copy and paste all output of cat /root/.ssh/authorized_keys
invoked before installing Ubuntu 14.04 LTS. Close editor saving changes to disk.
Try logging in as root via SSH using key-based authentication to test your setup, finally.