User Tools

Site Tools


notes:linux_automatic_network_install

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:linux_automatic_network_install [2024/05/07 12:28] – [PXE bootloader] Nikita Kipriyanovnotes:linux_automatic_network_install [2024/05/15 09:53] (current) – [Bootloader configuration] Nikita Kipriyanov
Line 20: Line 20:
 All (more or less) dynamic data is to be stored in ''/srv/tftp''. The structure of the directory: All (more or less) dynamic data is to be stored in ''/srv/tftp''. The structure of the directory:
  
-<tabbox PXELinux>+<tabbox GRUB>
  
-<code> +GRUB manual is available here: [[https://www.gnu.org/software/grub/manual/grub/]]
-srv/ +
-┠─ dhcp-hostsfile.cfg +
-┗━ tftp/ +
-   ┠─ pxelinux.+
-   ┠─ ldlinux.c32 +
-   ┣━ pxelinux.cfg/ +
-   ┃  ┠─ harddisk +
-   ┃  ┠─ menu +
-   ┃  ┠─ debian-bookworm +
-   ┃  ┠─ ol8u9 +
-   ┃  ┠─ default → menu +
-   ┃  ┠─ docker-vm → harddisk +
-   ┃  ┠─ test-pve → debian-bookworm +
-   ┃  ┠─ test-lvm → ol8u9 +
-   ┃  ┠─ 01-bc-24-11-51-cf-fc → docker-vm +
-   ┃  ┠─ 01-bc-24-11-4b-ae-dd → test-pve +
-   ┃  ┖─ 01-bc-24-11-28-81-76 → test-lvm +
-   ┣━ debian-bookworm/ +
-   ┃  ┠─ initrd.gz +
-   ┃  ┠─ linux +
-   ┃  ┖─ preseed-noswap.cfg +
-   ┣━ ol8u9/ +
-   ┃  ┣━ images/ +
-   ┃  ┃  ┖─ install.img +
-   ┃  ┠─ initrd.img +
-   ┃  ┠─ ks.cfg +
-   ┃  ┖─ vmlinuz +
-   ┗━ gentoo/ +
-      ┠─ gentoo +
-      ┖─ initramfs.igz +
-</code> +
- +
-The most logic is within ''/srv/tftp/pxelinux.cfg'' directory. There are several boot configurations: +
-  * ''harddisk'' — boot from local hard disk +
-  * ''menu'' — present a human-friendly menu, with a timeout to do the same thing as ''harddisk'' +
-  * ''debian-bookworm'' — start an unattended installation of a Debian 12 release +
-  * ''ol8u9'' — start an unattended installation of a Oracle Linux 8 release +
- +
-The rest items are symlinks to these files: +
-  * ''default'' — will be used by PXELinux if no other configuration file was matched; here it symlinks to the ''menu'', but can be diverted anywhere else +
-  * ''test-lvm'', ''test-pve'' and ''docker-vm'' are VMs or HW machines which are provisioned using this system, and in particular, ''test-lvm'' is being provisioned with OL8, ''test-pve'' is being provisioned with Debian and the ''docker-vm'' is already installed, so it is instructed to boot locally +
-  * ''01-xx-xx-xx-xx-xx-xx'' are symlinks named after the respective system's MAC address. If there are several NICs, we create several files, for each MAC. PXELinux will first try such a file and load it if it exists, and if it doesn't, it will load ''default''. This way, we precisely target each system to divert its boot path independently of each other. +
- +
-This is well tested setup. The main downside is that PXELinux doesn't support EFI boot, and we need to use some another bootloader which is capable of targeting computers precisely and manage its configuration separately. +
- +
-<tabbox GRUB>+
  
 <code> <code>
Line 92: Line 46:
    ┃  ┠─ ol8u9    ┃  ┠─ ol8u9
    ┃  ┠─ grub.cfg → menu    ┃  ┠─ grub.cfg → menu
-   ┃  ┠─ docker-vm → harddisk+   ┃  ┠─ docker-vm → localboot
    ┃  ┠─ test-pve → debian-bookworm    ┃  ┠─ test-pve → debian-bookworm
    ┃  ┠─ test-lvm → ol8u9    ┃  ┠─ test-lvm → ol8u9
Line 134: Line 88:
  
 Then the ''/srv/tftp/grub'' directory was simply archived and transferred to the boot server. Then the ''/srv/tftp/grub'' directory was simply archived and transferred to the boot server.
 +
 +<tabbox PXELinux>
 +
 +<code>
 +srv/
 +┠─ dhcp-hostsfile.cfg
 +┗━ tftp/
 +   ┠─ pxelinux.0
 +   ┠─ ldlinux.c32
 +   ┣━ pxelinux.cfg/
 +   ┃  ┠─ harddisk
 +   ┃  ┠─ menu
 +   ┃  ┠─ debian-bookworm
 +   ┃  ┠─ ol8u9
 +   ┃  ┠─ default → menu
 +   ┃  ┠─ docker-vm → harddisk
 +   ┃  ┠─ test-pve → debian-bookworm
 +   ┃  ┠─ test-lvm → ol8u9
 +   ┃  ┠─ 01-bc-24-11-51-cf-fc → docker-vm
 +   ┃  ┠─ 01-bc-24-11-4b-ae-dd → test-pve
 +   ┃  ┖─ 01-bc-24-11-28-81-76 → test-lvm
 +   ┣━ debian-bookworm/
 +   ┃  ┠─ initrd.gz
 +   ┃  ┠─ linux
 +   ┃  ┖─ preseed-noswap.cfg
 +   ┣━ ol8u9/
 +   ┃  ┣━ images/
 +   ┃  ┃  ┖─ install.img
 +   ┃  ┠─ initrd.img
 +   ┃  ┠─ ks.cfg
 +   ┃  ┖─ vmlinuz
 +   ┗━ gentoo/
 +      ┠─ gentoo
 +      ┖─ initramfs.igz
 +</code>
 +
 +The most logic is within ''/srv/tftp/pxelinux.cfg'' directory. There are several boot configurations:
 +  * ''harddisk'' — boot from local hard disk
 +  * ''menu'' — present a human-friendly menu, with a timeout to do the same thing as ''harddisk''
 +  * ''debian-bookworm'' — start an unattended installation of a Debian 12 release
 +  * ''ol8u9'' — start an unattended installation of a Oracle Linux 8 release
 +
 +The rest items are symlinks to these files:
 +  * ''default'' — will be used by PXELinux if no other configuration file was matched; here it symlinks to the ''menu'', but can be diverted anywhere else
 +  * ''test-lvm'', ''test-pve'' and ''docker-vm'' are VMs or HW machines which are provisioned using this system, and in particular, ''test-lvm'' is being provisioned with OL8, ''test-pve'' is being provisioned with Debian and the ''docker-vm'' is already installed, so it is instructed to boot locally
 +  * ''01-xx-xx-xx-xx-xx-xx'' are symlinks named after the respective system's MAC address. If there are several NICs, we create several files, for each MAC. PXELinux will first try such a file and load it if it exists, and if it doesn't, it will load ''default''. This way, we precisely target each system to divert its boot path independently of each other.
 +
 +This is well tested setup. The main downside is that PXELinux doesn't support EFI boot, and we need to use some another bootloader which is capable of targeting computers precisely and manage its configuration separately.
 +
 </tabbox> </tabbox>
  
Line 141: Line 144:
  
 ==== DNS, DHCP and TFTP servers ==== ==== DNS, DHCP and TFTP servers ====
 +
 +<tabbox dnsmasq>
  
 The default Debian's ''dnsmasq'' configuration can use the base configuration //and// the drop directory. We opt to use the latter.  The default Debian's ''dnsmasq'' configuration can use the base configuration //and// the drop directory. We opt to use the latter. 
Line 208: Line 213:
 cname = boot.test.ucom.am, vmgw.test.ucom.am cname = boot.test.ucom.am, vmgw.test.ucom.am
 </file> </file>
 +
 +<tabbox ISC DHCPD, ISC BIND, tftpd-hpa>
 +
 +  * [[https://www.hpe.com/psnow/resources/ebooks/a00112595en_us_v2/s_config_pxe_uefi.html|Configuring PXE servers for UEFI-based clients in a Linux environment]]
 +
 +</tabbox>
  
 ==== HTTP server ==== ==== HTTP server ====
Line 227: Line 238:
  
 ==== Bootloader configuration ==== ==== Bootloader configuration ====
 +
 +<tabbox GRUB>
 +
 +<file - /srv/tftp/grub/debian-bookworm>
 +set timeout=1
 +
 +menuentry 'Debian Bookworm PXE installer' {
 +    linux debian-bookworm/linux priority=critical debian-installer/language=en debian-installer/country=AM debian-installer/locale=ru_RU.UTF-8 keyboard-configuration/xkb-keymap=ru netcfg/get_hostname=install keyboard-configuration/optionscode=grp:caps_lock_toggle,grp_led:scroll preseed/url=tftp://boot.test.ucom.am/debian-bookworm/preseed-noswap.cfg
 +    initrd debian-bookworm/initrd.gz
 +}
 +
 +</file>
 +
 +<tabbox PXELinux>
 +
 <file - /srv/tftp/pxelinux.cfg/debian-bookworm> <file - /srv/tftp/pxelinux.cfg/debian-bookworm>
 default debian-bookworm-auto default debian-bookworm-auto
Line 234: Line 260:
     kernel debian-bookworm/linux     kernel debian-bookworm/linux
     append priority=critical initrd=debian-bookworm/initrd.gz debian-installer/language=en debian-installer/country=AM debian-installer/locale=ru_RU.UTF-8 keyboard-configuration/xkb-keymap=ru netcfg/get_hostname=install keyboard-configuration/optionscode=grp:caps_lock_toggle,grp_led:scroll preseed/url=tftp://boot.test.ucom.am/debian-bookworm/preseed-noswap.cfg     append priority=critical initrd=debian-bookworm/initrd.gz debian-installer/language=en debian-installer/country=AM debian-installer/locale=ru_RU.UTF-8 keyboard-configuration/xkb-keymap=ru netcfg/get_hostname=install keyboard-configuration/optionscode=grp:caps_lock_toggle,grp_led:scroll preseed/url=tftp://boot.test.ucom.am/debian-bookworm/preseed-noswap.cfg
- 
 </file> </file>
 +
 +</tabbox>
 +
 ==== Example preseed file ==== ==== Example preseed file ====
 Works for Bullseye too (it was actually originally developed for Bullseye, but worked with Bookworm like a charm)! Works for Bullseye too (it was actually originally developed for Bullseye, but worked with Bookworm like a charm)!
 +
 +<tabbox BIOS>
  
 <file - /srv/tftp/debian-bookworm/preseed-noswap.cfg> <file - /srv/tftp/debian-bookworm/preseed-noswap.cfg>
Line 364: Line 394:
   in-target chmod 0600 /root/.ssh/authorized_keys;   in-target chmod 0600 /root/.ssh/authorized_keys;
 </file> </file>
 +
 +<tabbox UEFI>
 +
 +</tabbox>
  
 ==== Additional documentation ==== ==== Additional documentation ====
Line 388: Line 422:
  
 ==== Bootloader configuration ==== ==== Bootloader configuration ====
 +
 +<tabbox GRUB>
 +
 +<file - /srv/tftp/grub/ol8u9>
 +set timeout=1
 +
 +menuentry 'Oracle Linux 8 PXE installer' {
 +    linux ol8u9/vmlinuz inst.repo=http://vmgw/ol8u9 inst.ks.sendmac inst.ks=http://vmgw/ol8u9/ks.cfg
 +    initrd ol8u9/initrd.img
 +}
 +</file>
 +
 +<tabbox PXELinux>
 +
 <file - /srv/tftp/pxelinux.cfg/ol8u9> <file - /srv/tftp/pxelinux.cfg/ol8u9>
 default ol8u9 default ol8u9
Line 396: Line 444:
 # it will append .../images/install.img or .../LiveOS/squashfs.img # it will append .../images/install.img or .../LiveOS/squashfs.img
 </file> </file>
 +
 +</tabbox>
  
 ==== Example kickstart file ==== ==== Example kickstart file ====
 +
 +<tabbox BIOS>
 +
 <file - /srv/tftp/ol8u9/ks.cfg> <file - /srv/tftp/ol8u9/ks.cfg>
 #platform=x86, AMD64, or Intel EM64T #platform=x86, AMD64, or Intel EM64T
Line 504: Line 557:
 %end %end
 </file> </file>
 +
 +<tabbox UEFI>
 +
 +</tabbox>
 +
 ==== Additional documentation ==== ==== Additional documentation ====
   * https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html-single/boot_options_for_rhel_installer/index   * https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html-single/boot_options_for_rhel_installer/index
notes/linux_automatic_network_install.1715084898.txt.gz · Last modified: by Nikita Kipriyanov