====== Network-booting Fedora ====== {{ :clipart:fedora_logo.png?50x50|Fedora logo}} You can use iPXE to boot into the [[https://fedoraproject.org/|Fedora]] Linux installer via HTTP. You can then install Fedora to a local hard disk or to an iSCSI or FCoE SAN target. These instructions should work for similar Linux distributions, such as [[https://www.redhat.com/products/enterprise-linux/|Red Hat Enterprise Linux (RHEL)]] and [[https://www.centos.org|CentOS]]. ===== Boot script ===== Create an iPXE [[:scripting|script]] file ''fedora.ipxe'' containing: #!ipxe # Set repository URI set mirror http://download.fedoraproject.org/pub/fedora/linux/releases/44 set repo ${mirror}/Everything/x86_64/os # Start installer kernel ${repo}/images/pxeboot/vmlinuz inst.repo=${repo} initrd ${repo}/images/pxeboot/initrd.img boot If you have mirrored the Fedora tree locally, then you should change the line set mirror http://download.fedoraproject.org/pub/fedora/linux/releases/44 to point to the URI of your local mirror. Booting and installing from a local mirror will be several times faster than using the public ''download.fedoraproject.org'' mirror. ===== UEFI Secure Boot ===== If you are using UEFI Secure Boot, then you will need to use the Fedora UEFI shim to authorise booting the Fedora kernel. For example: kernel ${repo}/images/pxeboot/vmlinuz inst.repo=${repo} initrd ${repo}/images/pxeboot/initrd.img shim ${repo}/EFI/BOOT/BOOTX64.EFI boot The ''[[:cmd:shim]]'' command will safely do nothing if the kernel can be booted without using a shim. You can leave the ''shim'' line in your script even when UEFI Secure Boot is disabled, or when you are using BIOS rather than UEFI. ===== Installing to a local disk ===== Boot using iPXE from the URI of your ''fedora.ipxe'' script, e.g. ''%%http://my.web.server/fedora.ipxe%%''. You should see iPXE download and boot into the Fedora installer via HTTP: {{ :screenshots:fedora_boot.png?360x200 |Booting from fedora.ipxe script}} {{ :screenshots:fedora_install.png?360x281 |Fedora installation screen}} You can now install Fedora to a local hard disk. Congratulations on successfully network-booting the Fedora installer! {{ :clipart:smile.png?200x200 |Success}} ===== Installing to a SAN target ===== You can install Fedora to an iSCSI or FCoE SAN target instead of to a local disk. To do this, you must modify the ''fedora.ipxe'' script to allow for installation to your SAN target disk. For example: #!ipxe # Set repository URI set mirror http://download.fedoraproject.org/pub/fedora/linux/releases/44 set repo ${mirror}/Everything/x86_64/os # Hook SAN target sanhook iscsi:192.168.0.1::::iqn.1992-01.com.example.target:fedora # Start installer if F12 is pressed, otherwise boot from SAN target prompt --key 0x197e --timeout 2000 Press F12 to install Fedora... || sanboot kernel ${repo}/images/pxeboot/vmlinuz inst.repo=${repo} initrd ${repo}/images/pxeboot/initrd.img boot You must change the line sanhook iscsi:192.168.0.1::::iqn.1992-01.com.example.target:fedora to specify the [[:sanuri|SAN URI]] of your iSCSI or FCoE target. ===== Automating the installation ===== You can use a [[https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html|kickstart]] file and the ''inst.ks=...'' kernel command line parameter to automate the actions taken once iPXE has started the Fedora installer. For example, if you have placed your ''ks.cfg'' file in your repository directory: kernel ${repo}/images/pxeboot/vmlinuz inst.repo=${repo} inst.ks=${repo}/ks.cfg initrd ${repo}/images/pxeboot/initrd.img boot ===== Downloading the full installer ===== The Fedora initrd image (''initrd.img'') is a small bootstrap image. Once the initrd starts, it will attempt to download the full installer image (''install.img'') from the repository specified by the ''inst.repo=...'' kernel command line parameter. You can choose to use iPXE to download both the initrd image and the installer image, and then use the ''root=...'' kernel command line parameter to direct Fedora to use the already downloaded installer image. For example: kernel ${repo}/images/pxeboot/vmlinuz inst.repo=${repo} root=live:/install.img initrd ${repo}/images/pxeboot/initrd.img initrd ${repo}/images/install.img /install.img boot