Add a machine
One more machine on the network, installed from the administration workstation. The installation writes an image, boots the machine on it, then applies the full system. The administration workstation itself installs differently : see Initial installation.
The machine is first described in etc/config.yaml, like
any host.
Install the machine
Section titled “Install the machine”-
Get the image
Fenêtre de terminal just build-isoThis image carries your deployment key. Another option, without building : the generic ISO, written to a USB drive ; the key is then authorized with a pairing code (next step).
-
Start the machine
Connect the computer to the network using a wired connection, then boot from the USB drive. The screen displays a DNF welcome message, followed by the IP address and the MAC address of the interface connected to the Internet (provided by the local gateway or your router) : write them down.
- IP: 10.0.0.50- MAC: aa:bb:cc:dd:ee:ffThe
dnf-netinfocommand displays them again, along with the network cards and disks.With the generic ISO, choose in the console menu 2) Add this machine to an existing network (or run
dnf-pair). The screen lists the network cards and disks, then displays a pairing code :Pairing code: 123456-7890 (10 min, a new one after)Nothing else to do on the machine : the first recipe run against it from the administration workstation (
host-infoorfull-install) asks for this code, then authorizes the deployment key. A machine that is already paired will not be asked again. In case of a typo : a 10-second wait before the next attempt ; after six codes,dnf-pairgenerates another one. Details in Gateway. -
Set the addresses (as soon as a zone exists)
The installation ends with a reboot, and the following steps must be able to find the machine again. Two cases :
- MAC address already declared: nothing to do, the gateway assigns the same fixed address to the USB drive and to the installed system;
- unknown MAC address: note it down, then declare it.
Fenêtre de terminal # just host-info <hôte> <ip-actuelle>just host-info poste 10.0.0.50Enter the value in
etc/config.yaml, with a fixed address, then redeploy the gateway for each affected zone :etc/config.yaml - hostname: "poste"zone: "maison:2.1"mac: "aa:bb:cc:dd:ee:ff"Fenêtre de terminal # Redéployer la passerelle localejust cleangit add . && git commit -m "host(poste): installation"just apply gw -
Install the system
Make sure the machine boots by default from the disk that will host the system, and not from the installation USB drive.
Fenêtre de terminal # just full-install <hôte> <utilisateur> <ip>just full-install poste nixos 10.0.0.50full-installinstalls the system, programs, configurations, and users. On the automatic reboot, it probes all known addresses of the machine (the installation address, its zone address, the transit address, its name) and continues on the one that responds. On an encrypted host, it also answers the LUKS prompt automatically. If it fails, the detailed steps are in theJustfile.
The system is installed and up to date. A standalone workstation is already fully usable ; the gateway is only necessary to create a zone (shared local network).
Install over an existing system
Section titled “Install over an existing system”A machine that is already running may hold a dynamic lease older than its
reservation. nixos-anywhere pins its target address for the whole run :
as soon as its installer does a DHCP request again, the machine switches to its
reserved address and the run talks into the void.
The recipe refuses to start on an address that the host will not keep. The simplest is to reboot the machine before installing, so that it takes its reserved address.
If the case happens anyway, nothing is lost : the installer is already loaded in memory on the machine, at the right address this time. Run it again on it ; the loading phase is skipped automatically :
just full-install poste root 10.0.2.1