LOGO

PXE Boot Ubuntu from Windows Server 2008 - A Step-by-Step Guide

May 8, 2013
PXE Boot Ubuntu from Windows Server 2008 - A Step-by-Step Guide

Setting up a Windows Server 2008 for Static Ubuntu Deployment

This document details the process of configuring a Windows Server 2008 system to deploy a static Ubuntu image. This allows diskless terminals to boot and run a complete Ubuntu installation.

The system leverages PXE booting, enabling numerous machines to operate Ubuntu without requiring local hard drives, provided they support this boot method.

Background and Authorship

The following instructions are based on a practical implementation developed by Alexander Karnitis and Cody Dull.

Both authors are employed by Hyndman Inc. and successfully implemented this solution to meet their professional requirements.

They generously contributed this guide to share their knowledge with the wider community.

Key Benefits of this Approach

  • Diskless Operation: Eliminates the need for hard drives in client machines.
  • Centralized Management: Simplifies software updates and image maintenance.
  • Scalability: Easily deploy Ubuntu to a large number of terminals.
  • PXE Booting: Utilizes a standard network booting protocol.

This method provides a cost-effective and efficient way to manage a fleet of Ubuntu-based terminals.

The core principle involves hosting the Ubuntu image on the Windows Server 2008 machine and making it accessible via network boot.

The Advantages of PXE Booting and Custom Ubuntu Images

Employing PXE booting streamlines network administration and reduces associated costs. The capability to distribute tailored Ubuntu images from a Windows Server environment significantly enhances system resilience.

This approach allows for standardized user environments, providing each user with a consistent base system. It also facilitates rapid system recovery through simple power cycling.

Key Benefits and Applications

Beyond standardization and recovery, PXE booting is invaluable for diagnosing issues on computers experiencing malfunctions.

While this guide focuses on Ubuntu, serving both Windows and Ubuntu images from a centralized Windows Server location is a potential expansion of this setup.

The core benefit lies in the centralized management and consistent deployment of operating system images.

  • Simplified network management
  • Reduced operational expenses
  • Enhanced system reliability
  • Streamlined diagnostics

Custom Ubuntu images delivered via PXE booting offer a powerful combination of flexibility and control.

Essential Requirements for Implementation

Successful deployment utilizing Windows Deployment Services necessitates several key components. These include a Windows Server 2008 machine configured to run Windows Deployment Services (WDS).

Core Infrastructure Components

A client device with PXE booting capability is also crucial for initiating the deployment process. Furthermore, a Windows Server machine operating as a DHCP server is required to assign IP addresses to clients.

Network File System (NFS) Considerations

An NFS server is a necessary element for storing and delivering deployment images. This guide operates under the assumption that the NFS server functions on the same machine as the WDS server, although a separate server can certainly be utilized.

Detailed Component Breakdown

The Windows Server 2008 machine serves as the central hub for WDS, handling image management and deployment tasks.

PXE Booting Explained

PXE booting allows client computers to initiate the boot process over a network connection, retrieving necessary files from the WDS server. This eliminates the need for local boot media.

DHCP Server Role

The DHCP server dynamically assigns IP configurations to clients, enabling them to communicate on the network and connect to the WDS server. Proper DHCP configuration is vital for successful PXE booting.

NFS Server Functionality

The NFS server provides network file sharing, specifically for storing the Windows images that will be deployed to client machines. Utilizing NFS ensures efficient image distribution.

Configuration Flexibility

While this guide details a configuration where the WDS and NFS services reside on the same server, it’s important to note that this is not a strict requirement.

Separate Server Deployment

The NFS server can be deployed on a dedicated machine, offering increased scalability and potentially improved performance. This separation can be beneficial in larger deployment environments.

Establishing the WDS Server

The installation of Windows Deployment Services on a Windows server is a relatively straightforward process. Microsoft provides comprehensive documentation to assist with the setup (guides for 2008 and 2008 R2 can be found here). This document will not reiterate those installation steps.

However, it’s crucial to install both the Deployment Server and the Transport Server roles. During role configuration, ensure the option to "Respond to all (known and unknown) client computers" is selected, unless the target computers are already registered within Active Directory.

Active Directory Considerations

The WDS server utilizes Active Directory to differentiate between known and unknown devices. This distinction impacts how the server handles boot requests.

Proceed with the official Microsoft guide until you reach the “Steps for adding images” section. We will implement image addition using pxelinux, bypassing the standard WDS image management procedures.

Setting up pxelinux

Obtain and unpack a syslinux distribution (a potential download location is available here). The next step involves transferring the necessary pxelinux files to the Windows Deployment Services (WDS) directory. For pxelinux version 5.01, the following files are required:

· Core\pxelinux.0

· Com32\menu\vesamenu.c32

· Com32\lib\libcom32.c32

· Com32\elflink\ldlinux.c32

· Com32\libutil\libutil.c32

· Com32\chain\chain.c32

These files should be copied into the appropriate architecture-specific directory – either \boot\x64, \boot\x86, or both. Following the file transfer, the architecture directory’s contents should resemble the following structure (minor variations exist between x86 and x64, but the pxelinux files remain consistent).

how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-2.jpg

The architecture directories are situated within the directory designated for WDS files during the WDS role customization process.

All remaining syslinux files are now superfluous and can be safely deleted from the system.

Configuring PXElinux

The pxelinux configuration file offers extensive customization options. It allows for the creation of tailored boot menus based on hardware characteristics, such as type and MAC address. Alternatively, menus can be configured according to IP addresses or address ranges. This system supports numerous boot methods and a resilient menu structure.

However, this guide will focus on utilizing the default configuration file and explaining the fundamental menu needed to pxeboot a liveCD. Initially, configuration files must reside within a subdirectory named “pxelinux.cfg”. Create this folder in the same location as the copied pxelinux files.

An “Images” folder was also created alongside “pxelinux.cfg” to house all Linux images. Consequently, the architecture folder’s structure should resemble the following:

how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-3.jpg

Within the pxelinux.cfg directory, create a file named “default” without any file extension.

Open this file using a text editor, such as notepad, and input the following configuration:

DEFAULT vesamenu.c32PROMPT 0NOESCAPE 0ALLOWOPTIONS 0
# Timeout in units of 1/10 s
TIMEOUT 30 #3 second timeout.
MENU MARGIN 10
MENU ROWS 16
MENU TABMSGROW 21
MENU TIMEOUTROW 26
MENU COLOR BORDER 30;44 #20ffffff #00000000 none
MENU COLOR SCROLLBAR 30;44 #20ffffff #00000000 none
MENU COLOR TITLE 0 #ffffffff #00000000 none
MENU COLOR SEL 30;47 #40000000 #20ffffff
MENU TITLE Netboot Menu
#-A sample liveCD boot
LABEL <Label Name>
kernel Images/UbuntuLIVE/casper/vmlinuz #location of the kernel
append boot=casper netboot=nfs nfsroot=<Windows Server IP>:/RemoteInstall/Boot/x64/Images/UbuntuLIVE initrd=Images/UbuntuLIVE /casper/initrd.gz

It’s important to note that this configuration assumes the image is stored under Images/UbuntuLIVE within the architecture directory.

Further details regarding the functionality of this configuration can be found at:

  • https://www.howtogeek.com/61263/how-to-network-boot-pxe-the-ubuntu-livecd/

Establishing an NFS Share

The process of creating an NFS share on a Windows server is relatively straightforward, achievable by adhering to the outlined steps. However, certain considerations regarding Permissions are crucial.

Initially, modifications to the NTFS permissions of the shared folder are necessary. Specifically, the 'Everyone' group must be granted both Read and Execute permissions.

how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-4.jpg
how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-5.jpg

It’s important to verify that the share created is configured as an NFS share, rather than an SMB share.

how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-6.jpg

Furthermore, all client machines will require anonymous access, and the NTFS 'Everyone' permissions must be extended to encompass anonymous users.

how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-7.jpg
how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-8.jpg

After the configuration is complete, allow time for the settings to propagate across the network. Once propagation is finished, serving LiveCDs from the Windows Server should be possible. A basic LiveCD, downloaded from the Ubuntu website, can be used for initial testing.

Alternatively, a customized LiveCD can also be served.

Additional Resources

  • https://www.howtogeek.com/109736/how-to-create-a-custom-ubuntu-live-cd-or-usb/

For more extensive customization, such as modifications to Unity, which are not well-suited to the previously mentioned method, or for deploying identical copies of a base machine, the following approach can be utilized.

Developing and Personalizing Your Ubuntu Live CD

The process of generating a customized image is straightforward. If a virtual machine player isn’t currently installed, download and install one. This guide’s instructions are specifically tailored for Oracle VM VirtualBox. You can find the download link here: https://www.virtualbox.org/wiki/Downloads

Begin by creating a new virtual machine. Designate Linux as the operating system type and select either Ubuntu or Ubuntu (64-bit) as the version, based on your requirements. Proceed by clicking Next.

how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-9.jpg

Specify the amount of memory to allocate to the virtual machine; a minimum of 1024 MB is suggested. Then, click Next.

how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-10.jpg

Opt to create a new virtual hard drive now, choosing the VDI type and enabling dynamic allocation.

how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-11.jpg
how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-12.jpg
how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-13.jpg

Determine the size of the virtual hard drive. A minimum of 4 GB is required, though 6-8 GB is preferable.

how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-14.jpg

Obtain Ubuntu 12.04 LTS Live CD from the official Ubuntu website. Ensure the version selected matches the one chosen in step 2. The download location is: http://www.ubuntu.com/download/desktop

Navigate to the settings of the virtual machine you’ve created. Within the Storage section, click the single disk listed under Controller: IDE. On the screen’s right side, under Attributes, click the disk icon adjacent to the CD/DVD Drive field. Select Choose a virtual file, then locate and select the downloaded Live CD.

how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-15.jpg

You can now launch the VM and proceed with the installation of Ubuntu 12.04.

Following installation, implement all desired modifications. Some of the alterations made included:

  • For use beyond system administrators, establish a User account with standard privileges, configured to log in automatically without a password.
  • Eliminate any superfluous programs based on the intended purpose of the final image. Larger programs that can be removed if unnecessary are: Firefox, LibreOffice, Gwibber, Thunderbird, empathy, and any games. This can be accomplished using the aptitude purge <program name> command in the terminal, or by installing Synaptic Package Manager from the Ubuntu Software Center.
  • Within Startup Applications, define an entry for any program you want to automatically launch upon startup. For instance, if the machines will primarily be used for remote desktop connections, configure Remmina Remote Desktop to auto-start.
  • To modify the default screen resolution, create a file that will execute the xrandr command.
    • A sample script used to disable the integrated display on our thin clients and adjust the resolution of connected monitors was as follows:
      xrandr --output LVDS1 –off
      xrandr --output VGA1 --primary --mode 1280x1024

    • Ensure the file is executable and add it to Startup Applications.
    • Additional commands can be executed at startup using this method.
    • Remember that this will function correctly only if all your machines label their displays consistently. If you have diverse models, a more complex solution might be required.

  • Remove any unnecessary icons from the launcher and add any desired ones.

After completing all customizations, you need to install Remastersys. Despite information found on some forums, Remastersys remains functional.

  • Obtain Synaptic Package Manager by either entering sudo apt-get install synaptic in the terminal or downloading it from the Ubuntu Software Center.
  • Run the following command in the terminal to download the repository gpg key:
    sudo wget –O –http://www.remastersys.com/Ubuntu/remastersys.gpg.key | apt-key add –
  • Open the file /etc/apt/sources.list with sudo privileges using a text editor, and append the following line, adjusting “precise” to your version if needed: deb http://www.remastersys.com/ubuntu precise main
  • Launch Synaptic and search for Remastersys. Select the Remastersys and Remastersys-gui packages for installation, then press Apply to proceed.
  • Open Remastersys-gui and choose Backup.

You now possess a custom live CD. The subsequent step involves transferring it to your server. If you have followed the Configuring Windows Server 2008 to PXE boot Ubuntu guide, here are the steps to deploy the image.

  • Execute the following command in the terminal to configure the Ubuntu VM as an NFS client: sudo apt-get install rpcbind nfs-common
  • Create a directory to mount the NFS share: sudo mkdir /NFS
  • You must now mount an NFS share with write permissions enabled. It is advisable to create a separate share specifically for transferring files from client to server, as the pxe boot file system typically lacks this permission.sudo mount <ip address of server>:/<NFS Name> /NFSex. sudo mount 192.168.1.24:/TempNFS /NFS
  • Copy the newly created iso to the mounted sharesudo cp /home/remastersys/remastersys/custom-back.iso /NFS
  • At this point, the Ubuntu VM is no longer needed. On your Windows server, navigate to the location where the iso was copied and extract its contents using an image file processing tool like Power ISO. http://www.poweriso.com/download.htm
  • Create a folder under <share root>/boot/x64/Images and copy the contents of the iso into this folder.
  • If your server is correctly configured, your customized Ubuntu Live CD should now appear as a pxe boot option when booting your diskless client.
    how-to-pxe-boot-an-ubuntu-image-from-windows-server-2008-16.jpg

To update the custom image, return to the VM and repeat the steps outlined above, starting with the disk image selection step. This time, instead of using the default CD downloaded from Ubuntu, utilize the backup iso file you exported.

#PXE boot#Ubuntu#Windows Server 2008#network boot#PXE server#Ubuntu installation