Using FOG to PXE boot into your favorite installer images


  • Moderator

    Setting up the foundation for installation

    Hopefully this setup will be pretty clean and easy (just hoping…)

    In this tutorial, I’ve personally setup each distribution and booted it into a virtual machine. I didn’t run the installer to completion, but I did ensure the installer was running as far as I took the install (unless otherwise noted).

    These setups were only tested with a bios (legacy mode) target computer. They WILL NOT work with uefi systems. For uefi based systems they have their own kernel requirements and options. The intent of this tutorial was to show its possible to boot your installation media via pxe booting.

    First we need to setup the storage locations for our boot images. The plan is to put the installation media on the /images nfs share and the boot kernel and initfs in the tftp boot directory.

    mkdir /images/os
    mkdir /tftpboot/os
    mkdir /mnt/loop
    

    For the foundation setup that should do it. On to the OS specific configuration…

    Link to Windows 10
    Link to Windows 7
    Link to Centos 7
    Link to Ubuntu 16.04
    Link to Linux Mint 18.1
    Link to Debian 9.2
    Link to OpenSuSE Leap 42.3
    Link to Fedora Workstation v26
    Link to installing Samba on your FOG server


  • Moderator

    Windows 10

    NOTE: At this time these instructions don't produce a fully functional Windows 10 recovery image. It does work to boot the recovery environment, but the recovery system doesn't have access to the wim files that contain the disk image to restore.

    Note2: After building the WinPE10 boot iso and noodling on this issue a bit more I think I "might" have a path forward for network booting Win10. Its not complicated, but not easy to do either. You WILL need to have the Windows 10 ADK installed on a Windows 10 computer to be able to do what I'm thinking. So stand by. I won't have time to work on or test the solution for a few days because I have other things going that I need to focus on.

    Note3: Interesting point when I was playing with Windows VLK media. That media had the coveted setup.exe program. This program was missing from the Dell OEM media, and that is why I went down the path below. SO if setup.exe exists on other media then we can use the same kind of configuration as with Windows 7 below. The hacking continues, please standby...

    1. First we’ll create the required directories:
    mkdir /images/os/mswindows
    mkdir /images/os/mswindows/10-1607
    mkdir /tftpboot/mswindows
    mkdir /tftpboot/mswindows/10-1607
    
    1. Now we’ll mount the Windows 10 iso over the loop directory. Then we’ll copy the contents of the DVD to the directory we built above.
    mount -o loop /{full path where you have the iso stored}/DellWin10OEM.iso /mnt/loop
    
    cp -R /mnt/loop/* /images/os/mswindows/10-1607
    umount /mnt/loop
    
    1. Download and install the latest wimboot kernel and extract it from the zip file.
    cd /images/os/mswindows
    wget http://git.ipxe.org/releases/wimboot/wimboot-latest.zip
    unzip wimboot-latest.zip
    
    1. Copy the wimboot file from the archive directory to root of the mswindows directory (we’ll need this for every windows boot media, so we’ll place it in a common spot).
    cp ./wimboot-2.6.0-signed/wimboot /images/os/mswindows
    
    1. The last bit of magic we need to do is setup a new FOG iPXE boot menu entry for this OS.
    2. In the fog WebGUI go to FOG Configuration->iPXE New Menu Entry
      Set the following fields
      Menu Item: os.Win10-1607
      Description: Windows 10 v1607
      Parameters:
      kernel nfs://${fog-ip}:/images/os/mswindows/wimboot
      initrd nfs://${fog-ip}:/images/os/mswindows/10-1607/bootmgr.exe bootmgr.exe
      initrd nfs://${fog-ip}:/images/os/mswindows/10-1607/boot/bcd bcd
      initrd nfs://${fog-ip}:/images/os/mswindows/10-1607/boot/fonts/segmono_boot.ttf segmono_boot.ttf
      initrd nfs://${fog-ip}:/images/os/mswindows/10-1607/boot/fonts/segoe_slboot.ttf segoe_slboot.ttf
      initrd nfs://${fog-ip}:/images/os/mswindows/10-1607/boot/fonts/segoen_slboot.ttf segoen_slboot.ttf
      initrd nfs://${fog-ip}:/images/os/mswindows/10-1607/boot/fonts/wgl4_boot.ttf wgl4_boot.ttf
      initrd nfs://${fog-ip}:/images/os/mswindows/10-1607/boot/boot.sdi boot.sdi
      initrd -n boot.wim nfs://${fog-ip}:/images/os/mswindows/10-1607/sources/BOOT.wim boot.wim
      imgstat
      boot || goto MENU
      Menu Show with: All Hosts
    3. That’s it, just pxe boot your target system and pick Windows 10 v1607 from the FOG iPXE boot menu.

    References:


  • Moderator

    Linux Mint

    1. First we’ll create the required directories:
    mkdir /images/os/mint
    mkdir /images/os/mint/18.1
    mkdir /tftpboot/mint
    mkdir /tftpboot/mint/18.1
    
    1. Now we’ll mount the Linux Mint 18.1 installer over the loop directory. Then we’ll copy the contents of the DVD to the directory we built above.
    mount -o loop -t iso9660 /{full path where you have the iso stored}/linuxmint-18.1-cinnamon-64bit.iso /mnt/loop
    
    cp -R /mnt/loop/* /images/os/mint/18.1
    umount /mnt/loop
    
    1. Finally we’ll copy the pxe boot kernel and intfs to the tftpboot directory.
    cp /images/os/mint/18.1/casper/vmlinuz /tftpboot/mint/18.1
    cp /images/os/mint/18.1/casper/initrd.lz /tftpboot/mint/18.1
    
    1. The last bit of magic we need to do is setup a new FOG iPXE boot menu entry for this OS.
    2. In the fog WebGUI go to FOG Configuration->iPXE New Menu Entry
      Set the following fields
      Menu Item: os.Mint18.1
      Description: Linux Mint 18.1
      Parameters:
      kernel tftp://${fog-ip}/mint/18.1/vmlinuz
      initrd tftp://${fog-ip}/mint/18.1/initrd.lz
      imgargs vmlinuz root=/dev/nfs boot=casper netboot=nfs nfsroot=${fog-ip}:/images/os/mint/18.1/ locale=en_US.UTF-8 keyboard-configuration/layoutcode=us quiet splash
      boot || goto MENU
      Menu Show with: All Hosts
    3. That’s it, just pxe boot your target system and pick Linux Mint 18.1 from the FOG iPXE boot menu.

    References:
    http://labalec.fr/erwan/?p=534
    https://forums.fogproject.org/topic/10939/fog-iso-booting


  • Moderator

    Centos 7

    1. First we’ll create the required directories:
    mkdir /images/os/centos
    mkdir /images/os/centos/7
    mkdir /tftpboot/os/centos
    mkdir /tftpboot/os/centos/7
    
    1. Now we’ll mount the Centos 7 installer over the loop directory. Then we’ll copy the contents of the DVD to the directory we built above.
    mount -o loop -t iso9660 /{full path where you have the iso stored}/CentOS7-x86_64.iso /mnt/loop
    
    cp -R /mnt/loop/* /images/os/centos/7
    umount /mnt/loop
    
    1. Finally we’ll copy the pxe boot kernel and intfs to the tftpboot directory.
    cp /images/os/centos/7/images/pxeboot/vmlinuz /tftpboot/os/centos/7
    cp /images/os/centos/7/images/pxeboot/initrd.img /tftpboot/os/centos/7
    
    1. The last bit of magic we need to do is setup a new FOG iPXE boot menu entry for this OS.
    2. In the fog WebGUI go to FOG Configuration->iPXE New Menu Entry
      Set the following fields
      Menu Item: os.Centos7
      Description: Centos 7 v1607 {or what ever version you are building}
      Parameters:
      kernel tftp://${fog-ip}/os/centos/7/vmlinuz
      initrd tftp://${fog-ip}/os/centos/7/initrd.img
      imgargs vmlinuz initrd=initrd.img root=live:nfs://${fog-ip}/images/os/centos/7/LiveOS/squashfs.img ip=dhcp repo=nfs://${fog-ip}/images/os/centos/7 splash quiet
      boot || goto MENU
      Menu Show with: All Hosts
    3. That’s it, just pxe boot your target system and pick Centos 7 from the FOG iPXE boot menu.

    References:
    https://forums.fogproject.org/topic/8488/how-to-pxe-boot-cent-os-7/63
    https://www.tecmint.com/install-pxe-network-boot-server-in-centos-7/


  • Moderator

    Windows 7

    1. First we’ll create the required directories:
    mkdir /images/os/mswindows
    mkdir /images/os/mswindows/7Pro-x64
    mkdir /tftpboot/mswindows
    mkdir /tftpboot/mswindows/7Pro-x64
    
    1. Now we’ll mount the Windows 7 Pro x64 iso over the loop directory. Then we’ll copy the contents of the DVD to the directory we built above.
    mount -o loop /{full path where you have the iso stored}/DellWin7ProX64.iso /mnt/loop
    
    cp -R /mnt/loop/* /images/os/mswindows/7Pro-x64
    umount /mnt/loop
    
    1. Beyond this point you will need a Windows 10 workstation. You also need to be aware what version of windows 10 you current have. You need to download the proper version of Windows ADK for the version of Windows 10 you will execute these instructions on. Yes I know this is a Win7 guide. I wanted to create a single how-to for both Windows 7 and Windows 10. Since support for Win7 is up in just a few years, I have to except that Win10 will be a reality soon and get with the program.
    2. Download the appropriate ADK for the version of Win10 you have from here: https://developer.microsoft.com/en-us/windows/hardware/windows-assessment-deployment-kit
    3. Launch the ADK installer. You will be presented with about 15 different modules to install. You only “need” the preboot environment (WinPE) stuff. You will have an option to install a bunch of stuff. You can either pick the defaults or just narrow down your selection to the WinPE stuff.
    4. It might take as long as 15 minutes to install depending on your network connection and target computer.
    5. While this step is not necessairy it is also a bit of an assurance that WinPE10 will have a good install of drivers needed to boot new hardware.
    6. Download the WinPE10 drivers from the Dell Enterprise site here: http://en.community.dell.com/techcenter/enterprise-client/w/wiki/11530.winpe-10-driver-pack
    7. I realize that you may not be using a Dell for your imaging, don’t worry these drivers only cover network and disk subsystems.
    8. Extract the winpe folder from the cab file and install it in the winpe folder in the root of c: drive (c:\winpe).
    9. After the install launch the ADK environment from Start Button->Windows Kits->Windows ADK-><something> Make sure you run this command window as Administrator. You need admin rights to use DISM.
    10. In the command window, you will probably want to change back to the root of C: because the path is a bit long and confusing.
    11. For the rest of the instructions we’ll just go copy and paste. Its fast and quick.
    cd c:\
    copype amd64 C:\WinPE_amd64
    
    Dism /Mount-Image /ImageFile:"C:\WinPE_amd64\media\sources\boot.wim" /index:1 /MountDir:"C:\WinPE_amd64\mount"
    
    Dism /Add-Driver /Image:"C:\WinPE_amd64\mount" /Driver:"c:\winpe\x64" /Recurse /ForceUnsigned
    
    1. Now we need to edit the WinPE startup file to have it mount our windows (samba) network share.
    notepad C:\WinPE_amd64\mount\Windows\System32\Startnet.cmd
     @echo off
      echo Setting up WinPE
      wpeinit
    
      REM Set power configuration to Performance
      powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
    
      echo Connecting to the remote share
      net use z: \\<server_name>\<share_name> /user:<domain\uid> <pass>
      z:
      setup.exe
    
    1. Now that we have the settings the way we need them. Lets close the wim file and create our ISO.
    Dism /Unmount-Image /MountDir:"C:\WinPE_amd64\mount" /commit
    
    MakeWinPEMedia /ISO C:\WinPE_amd64 C:\WinPE_amd64\WinPE_amd64.iso
    
    1. Now move the C:\WinPE_amd64\WinPE_amd64.iso file to the FOG server in the /images/os/mswindows/7Pro-x64 directory.

    2. The last bit of magic we need to do is setup a new FOG iPXE boot menu entry for this OS.

    3. In the fog WebGUI go to FOG Configuration->iPXE New Menu Entry
      Set the following fields
      Menu Item: os.Win7Pro-x64
      Description: Windows 7 Pro x64 OEM
      Parameters:
      initrd nfs://${fog-ip}:/images/os/mswindows/7Pro-x64/WinPE_amd64.iso
      chain memdisk iso raw
      boot || goto MENU
      Menu Show with: All Hosts

    4. That’s it, just pxe boot your target system and pick Windows 7 Pro x64 OEM from the FOG iPXE boot menu.

    References:
    https://forums.fogproject.org/topic/7765/pxe-booting-into-ms-windows-7-setup


  • Moderator

    Ubuntu 16.04

    1. First we’ll create the required directories:
    mkdir /images/os/ubuntu
    mkdir /images/os/ubuntu/16.04
    mkdir /tftpboot/os/ubuntu
    mkdir /tftpboot/os/ubuntu/16.04
    
    1. Now we’ll mount the Ubuntu 16.04 installer over the loop directory. Then we’ll copy the contents of the DVD to the directory we built above.
    mount -o loop -t iso9660 /{full path where you have the iso stored}/ubuntu-16.04.3-server-amd64.iso /mnt/loop
    
    cp -R /mnt/loop/* /images/os/ubuntu/16.04
    umount /mnt/loop
    
    1. Finally we’ll copy the pxe boot kernel and intfs to the tftpboot directory.
    cp /images/os/ubuntu/16.04/install/vmlinuz /tftpboot/os/ubuntu/16.04
    cp /images/os/ubuntu/16.04/install/netboot/ubuntu-installer/amd64/initrd.gz /tftpboot/os/ubuntu/16.04
    

    Note: If you get to the point of booting into the installer and the installer keeps asking for a cdrom, you have the wrong initfs. This tripped me up for quite some time until I found a post that solved what I was doing wrong. The path above is accurate and works. You have been warned!!

    1. The last bit of magic we need to do is setup a new FOG iPXE boot menu entry for this OS.
    2. In the fog WebGUI go to FOG Configuration->iPXE New Menu Entry
      Set the following fields
      Menu Item: os.Ubuntu1604
      Description: Ubuntu 16.04.03
      Parameters:
      kernel tftp://${fog-ip}/os/ubuntu/16.04/vmlinuz
      initrd tftp://${fog-ip}/os/ubuntu/16.04/initrd.gz
      imgargs vmlinuz initrd=initrd.gz root=/dev/nfs netboot=nfs nfsroot=${fog-ip}:/images/os/ubuntu/16.04/ locale=en_US.UTF-8 ip=dhcp rw
      boot || goto MENU
      Menu Show with: All Hosts
    3. That’s it, just pxe boot your target system and pick Ubuntu 16.04.03 from the FOG iPXE boot menu.

    References:
    https://help.ubuntu.com/community/DisklessUbuntuHowto
    https://askubuntu.com/questions/476508/why-ubuntu-server-asks-to-insert-a-cd-rom-when-installed-from-pxe


  • Moderator

    Debian 9.2

    1. First we’ll create the required directories:
    mkdir /images/os/debian
    mkdir /images/os/debian/9.2
    mkdir /tftpboot/os/debian
    mkdir /tftpboot/os/debian/9.2
    
    1. Now we’ll mount the Debian 9.2 installer over the loop directory. Then we’ll copy the contents of the DVD to the directory we built above.
    mount -o loop -t iso9660 /{full path where you have the iso stored}/debian-9.2.1-amd64-xfce-CD-1.iso /mnt/loop
    
    cp -R /mnt/loop/* /images/os/debian/9.2
    umount /mnt/loop
    
    1. At this point we need to go out and download the netboot kernel and initrd files from the Debian site. We’ll create a temp directory, download the tar ball and extract the two files we need.
    cd /tmp
    mkdir netboot
    cd /tmp/netboot
    wget http://ftp.nl.debian.org/debian/dists/stretch/main/installer-amd64/current/images/netboot/netboot.tar.gz
    tar -zxf netboot.tar.gz
    cd ./debian-installer/amd64
    cp linux /tftpboot/os/debian/9.2
    cp initrd.gz /tftpboot/os/debian/9.2
    cd /tmp
    rm -rf ./netboot
    

    Note: If you get to the point of booting into the installer and the installer keeps asking for a cdrom, you have the wrong initfs. You must have the initrd file from the Debian netboot package. Unlike other distributions, the netboot files are not on the typical installation media as far as I found.

    1. The last bit of magic we need to do is setup a new FOG iPXE boot menu entry for this OS.
    2. In the fog WebGUI go to FOG Configuration->iPXE New Menu Entry
      Set the following fields
      Menu Item: os.Debian92
      Description: Debian 9.2.1
      Parameters:
      kernel tftp://${fog-ip}/os/debian/9.2/linux
      initrd tftp://${fog-ip}/os/debian/9.2/initrd.gz
      imgargs linux initrd=initrd.gz root=/dev/nfs netboot=nfs nfsroot=${fog-ip}:/images/os/debian/9.2/ ip=dhcp rw
      boot || goto MENU
      Menu Show with: All Hosts
    3. That’s it, just pxe boot your target system and pick Debian 9.2.1 from the FOG iPXE boot menu.

    References:
    http://students.mimuw.edu.pl/~bassa/uo/linux-adv/debian-install-pxe-netboot.pdf


  • Moderator

    OpenSuSE Leap 42.3

    Note: I have not personally tested this configuration. When I went to download the OpenSuse ISO it was going to take about 3hrs on my FIOS internet connection. I tried a few times and the download as interrupted each time. So I decided, "I don't got time for this". I put together these instructions based on dead reckoning on what was needed. Will it work?? YMMV

    1. First we’ll create the required directories:
    mkdir /images/os/opensuse
    mkdir /images/os/opensuse/Leap43.2
    mkdir /tftpboot/os/opensuse
    mkdir /tftpboot/os/opensuse/Leap43.2
    
    1. Now we’ll mount the OpenSuSE Leap 43.2 installer over the loop directory. Then we’ll copy the contents of the DVD to the directory we built above.
    mount -o loop -t iso9660 /{full path where you have the iso stored}/openSUSE-Leap-42.3-DVD-x86_64.iso /mnt/loop
    
    cp -R /mnt/loop/* /images/os/opensuse/Leap43.2
    umount /mnt/loop
    
    1. At this point we need to go out and download the network/usb kernel and initrd files from the OpenSuSE site. We’ll create a temp directory, download and mount the iso image as we have done before. Then extract the two files we need.
    cd /tmp
    wget http://download.opensuse.org/distribution/leap/42.3/iso/openSUSE-Leap-42.3-NET-x86_64.iso
    mount -o loop -t iso9660 /tmp/openSUSE-Leap-42.3-NET-x86_64.iso /mnt/loop
    cp /mnt/loop/boot/x86_64/loader/linux /tftpboot/os/opensuse/Leap43.2
    cp /mnt/loop/boot/x86_64/loader/initrd /tftpboot/os/opensuse/Leap43.2
    umount /mnt/loop
    
    rm -rf /tmp/openSUSE-Leap-42.3-NET-x86_64.iso
    

    Note: If you get to the point of booting into the installer and the installer keeps asking for a cdrom, you have the wrong initfs. You must have the initrd file from the OpenSuSE Net/USB boot ISO.

    1. The last bit of magic we need to do is setup a new FOG iPXE boot menu entry for this OS.
    2. In the fog WebGUI go to FOG Configuration->iPXE New Menu Entry
      Set the following fields
      Menu Item: os.OpenSuSEL42-3
      Description: OpenSuSE Leap 42.3
      Parameters:
      kernel tftp://${fog-ip}/os/opensuse/Leap43.2/linux
      initrd tftp://${fog-ip}/os/opensuse/Leap43.2/initrd
      imgargs linux initrd=initrd ip=dhcp repo=nfs://${fog-ip}:/images/os/opensuse/Leap43.2/
      boot || goto MENU
      Menu Show with: All Hosts
    3. That’s it, just pxe boot your target system and pick OpenSuSE Leap 42.3 from the FOG iPXE boot menu.

    Reference:
    https://tr.opensuse.org/SDB:Network_Installation_of_SuSE_Linux_via_PXE_Boot


  • Moderator

    Fedora 26 Workstation

    1. First we’ll create the required directories:
    mkdir /images/os/fedora
    mkdir /images/os/fedora/W26
    mkdir /tftpboot/os/fedora
    mkdir /tftpboot/os/fedora/W26
    
    1. Now we’ll mount the Fedora 26 Workstation installer over the loop directory. Then we’ll copy the contents of the DVD to the directory we built above.
    mount -o loop -t iso9660 /{full path where you have the iso stored}/Fedora-Workstation-Live-x86_64-26-1.5.iso /mnt/loop
    
    cp -R /mnt/loop/* /images/os/fedora/W26
    umount /mnt/loop
    
    1. Finally we’ll copy the pxe boot kernel and intfs to the tftpboot directory.
    cp /images/os/fedora/W26/isolinux/vmlinuz /tftpboot/os/fedora/W26
    cp /images/os/fedora/W26/isolinux/initrd.img /tftpboot/os/fedora/W26
    
    1. The last bit of magic we need to do is setup a new FOG iPXE boot menu entry for this OS.
    2. In the fog WebGUI go to FOG Configuration->iPXE New Menu Entry
      Set the following fields
      Menu Item: os.FedoraW26
      Description: Fedora Workstation v26
      Parameters:
      kernel tftp://${fog-ip}/os/fedora/W26/vmlinuz
      initrd tftp://${fog-ip}/os/fedora/W26/initrd.img
      imgargs vmlinuz initrd=initrd.img root=live:nfs://${fog-ip}/images/os/fedora/W26/LiveOS/squashfs.img ip=dhcp repo=nfs://${fog-ip}/images/os/fedora/W26 splash quiet
      boot || goto MENU
      Menu Show with: All Hosts
    3. That’s it, just pxe boot your target system and pick Fedora Workstation v26 from the FOG iPXE boot menu.

    Reference:
    https://forums.fedoraforum.org/showthread.php?t=310643


  • Moderator

    Installing SAMBA on the FOG Server

    <what am I thinking!>

    Note: These instructions are not complete, they are only notes for what I need to see fits together.

    Centos 7 Instructions.

    yum install samba samba-common samba-winbind 
    
    /not required but placing for context
    semanage fcontext -a -t samba_share_t ‘/images/os/mswindows(/.*)?’
    restorecon -R -v /images/os/mswindows
    
    firewall-cmd --add-service=samba --permanent
    firewall-cmd --reload
    /end not required
    
    
    systemctl enable smb
    systemctl enable winbind
    systemctl enable nmb
    
    /save until after configuration
    systemctl restart smb
    systemctl restart winbind
    systemctl restart nmb
    systemctl status smb
    
    mv /etc/samba/smb.conf /etc/samba/smb.conf.old
    vi /etc/samba/smb.conf
    
    [global]
    workgroup = FOGPXE
    server string = Fog Project Imaging
    log file = /var/log/samba/log.%m
    max log size = 50
    idmap config * : backend = tdb
    cups options = raw
    netbios name = fogpxeserver
    map to guest = bad user
    dns proxy = no
    public = yes
    nt acl support = no
    security = user
    guest account = nobody
    
    [win7oem]
       path = /images/os/mswindows/7Pro-x64
       comment = Windows 7 OEM Installation DVD
       valid users = "username" (User must have a samba password "smbpasswd -a 'Username'")
       writeable = no
       browseable = yes
       read only = yes
    
    [win10-1607]
       path = /images/os/mswindows/10-1607
       comment = Windows 10 1607 Installation DVD
       valid users = "username" (User must have a samba password "smbpasswd -a 'Username'")
       writeable = no
       browseable = yes
       read only = yes
    

Log in to reply
 

489
Online

39192
Users

10844
Topics

103205
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.