Install NixOS on Hetzner Online: Difference between revisions
imported>Shyim pin nixos-generator version |
imported>Nilsherzig No edit summary |
||
| Line 5: | Line 5: | ||
There are three ways at the time to install NixOS on Hetzner dedicated: | There are three ways at the time to install NixOS on Hetzner dedicated: | ||
# From Hetzner's rescue image one can boot into the nixos installer using a custom kexec image that is configured with the fixed IPv6 provided by Hetzner and also contain your ssh key. Tip: The kexec tarball as generated by [https://github.com/nix-community/nixos-generators nixos-generators] can remain put into the /boot partition for future use. | # From Hetzner's rescue image, one can boot into the nixos installer using a custom kexec image that is configured with the fixed IPv6 provided by Hetzner and also contain your ssh key. Tip: The kexec tarball as generated by [https://github.com/nix-community/nixos-generators nixos-generators] can remain put into the /boot partition for future use. | ||
# Hetzner also provides an interface to upload your own ISO-images. Also here you may want to build your own iso-image, which has openssh with ssh keys due the lack of a remote console. | # Hetzner also provides an interface to upload your own ISO-images. Also, here you may want to build your own iso-image, which has openssh with ssh keys due the lack of a remote console. | ||
# An easier method to install NixOS on Hetzner, is to use the existing integration into NixOps. | # An easier method to install NixOS on Hetzner, is to use the existing integration into NixOps. | ||
# An example to install NixOS in the Hetzner rescue mode, including full RAID partitioning, is available [https://github.com/nix-community/nixos-install-scripts/blob/master/hosters/hetzner-dedicated/hetzner-dedicated-wipe-and-install-nixos.sh here]. | # An example to install NixOS in the Hetzner rescue mode, including full RAID partitioning, is available [https://github.com/nix-community/nixos-install-scripts/blob/master/hosters/hetzner-dedicated/hetzner-dedicated-wipe-and-install-nixos.sh here]. | ||
| Line 14: | Line 14: | ||
From Hetzner's [https://accounts.hetzner.com/login web interface], one can obtain both ipv4/ipv6 addresses and gateways. | From Hetzner's [https://accounts.hetzner.com/login web interface], one can obtain both ipv4/ipv6 addresses and gateways. | ||
Hetzner does announce ipv6 addresses servers, so you need to assign those statically. | Hetzner does announce ipv6 addresses servers, so you need to assign those statically. | ||
In this example we use networkd to configure the interface. The same configuration can be used for both | In this example, we use networkd to configure the interface. The same configuration can be used for both | ||
the kexec installation image and the final server configuration. | the kexec installation image and the final server configuration. | ||
| Line 88: | Line 88: | ||
First, reboot the machine in Rescue mode. Note that just enabling Rescue mode from the dashboard doesn't immediately reboot so make sure to power cycle the server. The Rescue mode runs from a RAM disk, so make also sure that you have enough RAM. Temporarily rescaling to 32 GiB of RAM (the RAM disk will be half of the available RAM) during the bootstrapping process helps. Make sure to select your SSH public key. SSH into the machine: | First, reboot the machine in Rescue mode. Note that just enabling Rescue mode from the dashboard doesn't immediately reboot so make sure to power cycle the server. The Rescue mode runs from a RAM disk, so make also sure that you have enough RAM. Temporarily rescaling to 32 GiB of RAM (the RAM disk will be half of the available RAM) during the bootstrapping process helps. Make sure to select your SSH public key. SSH into the machine: | ||
You can skip the entire next part by using https://github.com/nix-community/nixos-images#kexec-tarballs | |||
<syntaxHighlight lang=bash> | <syntaxHighlight lang=bash> | ||
| Line 123: | Line 125: | ||
</syntaxHighlight> | </syntaxHighlight> | ||
At this point the shell should stop responding. Kill the shell and ssh back into the machine. The server public key will have changed. | At this point, the shell should stop responding. Kill the shell and ssh back into the machine. The server public key will have changed. | ||
<syntaxHighlight lang=bash> | <syntaxHighlight lang=bash> | ||
| Line 135: | Line 137: | ||
# In this particular machine we have two NVMe disks | # In this particular machine we have two NVMe disks | ||
# If your machine has > 2TB drives, open a ticket and ask for UEFI boot, it will save you a lot of hassle | |||
format /dev/nvme0n1 | format /dev/nvme0n1 | ||
format /dev/nvme1n1 | format /dev/nvme1n1 | ||