Using FOG to PXE boot into your favorite installer images


  • Moderator

    Ubuntu 16.04.03

    1. First we’ll create the required directories:
    mkdir -p /images/os/ubuntu/16.04
    mkdir -p /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
    # See Note2 below
    cp /images/os/ubuntu/16.04/install/netboot/ubuntu-installer/amd64/initrd.gz /tftpboot/os/ubuntu/16.04
    

    Note1: 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!!
    and…
    Note2: If your Ubuntu 16.04 disk image does NOT CONTAIN A NETBOOT DIRECTORY (some users are reporting this), then download http://archive.ubuntu.com/ubuntu/dists/artful/main/installer-amd64/current/images/netboot/netboot.tar.gz file and extract the initrd.gz from ubuntu-installer/amd64 directory and copy to /tftpboot/os/ubuntu/16.04. The DVD I downloaded {ubuntu-16.04.3-server-amd64.iso} contained the netboot files
    4. The last bit of magic we need to do is setup a new FOG iPXE boot menu entry for this OS.
    5. 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
    6. 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 -p /images/os/debian/9.2
    mkdir -p /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.
    4. The last bit of magic we need to do is setup a new FOG iPXE boot menu entry for this OS.
    5. 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
    6. 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 -p /images/os/opensuse/Leap43.2
    mkdir -p /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.
    4. The last bit of magic we need to do is setup a new FOG iPXE boot menu entry for this OS.
    5. 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
    6. 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 -p /images/os/fedora/W26
    mkdir -p /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
    In this section we’ll setup samba on your fog server. This will give your WinPE environment access to the MS Windows images we stored in the /images/os/mswindows directory. You could use a traditional MS Windows server for this function and skip the entire samba setup. That decision is up to you. I’m documenting the process of enabling CIFS (windows file share access) on your fog server to provide a consistent place to store your imaging files. In this setup the samba file shares will be share as read only and can only be access by the user account we will setup in this post. SAMBA will not be connected to your AD. AD users will not be able to mount or access these shares. Your FOG server will be a standalone server with its own access control and users.

    Centos 7 Instructions:

    yum install samba samba-common samba-winbind 
    
    systemctl enable smb
    systemctl enable winbind
    systemctl enable nmb
    
    # Create a linux user called fogpxeu we will use this account to connect to
    # the server from our WinPE environment. 
    adduser --no-create-home --shell /sbin/nologin --user-group fogpxeu
    # Assign a complex password since we will never use it we will use
    # the samba password we will define below.
    passwd fogpxeu
    
    mv /etc/samba/smb.conf /etc/samba/smb.conf.old
    

    We need to create our custom config file for samba. So use your favorite text editor and edit /etc/samba/smb.conf. My favorite is vi.

    vi /etc/samba/smb.conf
    

    Insert the following text into the smb.conf file.

    [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 = "fogpxeu"
       writeable = no
       browseable = yes
       read only = yes
    
    [win10-1607]
       path = /images/os/mswindows/10-1607
       comment = Windows 10 1607 Installation DVD
       valid users = "fogpxeu" 
       writeable = no
       browseable = yes
       read only = yes
    

    Now lets start the samba services

    systemctl restart smb
    systemctl restart winbind
    systemctl restart nmb
    systemctl status smb
    
    # Define the password here  you will use to connect to the network
    # share from the WinPE environment. Document this password, 
    # you will need it when you setup your WinPE boot image. 
    smbpasswd -a 'fogpxeu'
    $ New SMB password:
    $ Retype new SMB password:
    $ Added user fogpxeu.
    
    

    Ubuntu Instructions:
    <Coming Soon>

    Testing to setup:
    Lets see if the shares are visible from a windows computer. On your favorite windows computer, open a command window and key in the net view command.

    C:\Users\admin>net view \\192.168.1.55
    Shared resources at \\192.168.1.55
    
    Fog Project Imaging
    
    Share name  Type  Used as  Comment
    
    -------------------------------------------------------------------------------
    win10-1607  Disk           Windows 10 1607 Installation DVD
    win7oem     Disk           Windows 7 OEM Installation DVD
    The command completed successfully.
    

    Nice! we can see our shares. Now lets see if we can mount the network share. From the same command window used above key in the following.

    C:\Users\admin>net use t: \\192.168.1.55\win10-1607  /user:fogpxeu
    Enter the password for 'fogpxeu' to connect to '192.168.1.55':
    The command completed successfully.
    

    Double nice!! We are able to map the drive as the fogpxeu user. Lets see if we can see any files on the share.

    C:\Users\admin>dir t:
     Volume in drive T is win10-1607
     Volume Serial Number is B512-AE19
    
     Directory of T:\
    
    10/13/2017  01:50 PM    <DIR>          .
    10/13/2017  09:35 PM    <DIR>          ..
    10/13/2017  01:50 PM    <DIR>          boot
    10/13/2017  01:51 PM    <DIR>          sources
    10/13/2017  01:50 PM    <DIR>          efi
    10/13/2017  01:48 PM               135 readme.txt
    10/13/2017  01:50 PM         1,152,864 bootmgr.efi
    10/13/2017  01:50 PM           395,268 bootmgr
                   3 File(s)      1,548,267 bytes
                   5 Dir(s)  34,709,315,584 bytes free
    

    Great!! we can mount the share and can view the contents. The last bit is to disconnect from the share since our test was successful.

    net use t: /delete
    

Log in to reply
 

376
Online

7.5k
Users

14.6k
Topics

137.4k
Posts