Install NixOS on Hetzner Cloud: Difference between revisions
imported>Riotbib No edit summary |
imported>Fadenb m Fix channel name in nixos-infect example (missing a character) |
||
Line 12: | Line 12: | ||
* Run following script. Replace <code>NIX_CHANNEL</code> variable with the version string you wish to install. | * Run following script. Replace <code>NIX_CHANNEL</code> variable with the version string you wish to install. | ||
<syntaxHighlight lang=bash> | <syntaxHighlight lang=bash> | ||
curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-22. | curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-22.11 bash -x | ||
</syntaxHighlight> | </syntaxHighlight> | ||
* Reboot into NixOS | * Reboot into NixOS |
Revision as of 15:22, 13 May 2023
Installation
nixos-infect
Beside the manual installation, one way to setup NixOS is to replace an existing installation, for example the latest Ubuntu image, with nixos-infect. The installation process follows these steps:
- Boot into the existing operating system, preferably Ubuntu or Debian
- Login as root or with root permissions
- Deploy your SSH public key for the current root user. This key will be used later for authentication into the NixOS system.
- Run following script. Replace
NIX_CHANNEL
variable with the version string you wish to install.
curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-22.11 bash -x
- Reboot into NixOS
Network configuration
The public IPv4 address of the server will be automatically obtained by NixOS via DHCP, no extra configuration needed. For IPv6 you have to assign the network address and gateway manually like this:
networking = {
interfaces.ens3.ipv6.addresses = [{
address = "2a01:4f8:....:....::";
prefixLength = 64;
}];
defaultGateway6 = {
address = "fe80::1";
interface = "ens3";
};
};
Replace the address
part with the correct IPv6 address of your instance. You can find it on the Hetzner Cloud Console by selecting the respective server and navigation to the "Networking" section in the left menu.