EDIT 1 (20110604): Fixed the WAIK Link
EDIT 2 (20110606): It appears that even though I generated and have successfully booted from the AMD64 WinPE image, on newer hardware I reach the error of “Subsystem needed to support the image type is not present”. This was actually resolved by just booting from the X86.iso. That being said, I am making changes below to remove generation for the amd64.iso and making the necessary changes to pictures and such. Old data will be struck through so it is still retained by ignored.
Hi all,
Its been awhile but I finally have a very good post to put out here that could be of some use people. Most of the existing documents and blog posts I have found were helpful in getting me in the right direction but generally lacked good detail on how exactly to achieve this.
This document is going to be continuously updated to ensure the details are as clear as possible and all of the little nuances are covered.
The items we are going to cover are:
1. Installing TFTP & PXELinux on CentOS 5.6
2. Setting up PXELinux for booting WinPE
3. Setting up Samba and the files to use to install Windows 7
4. Creating a WinPE disk image to boot (both AMD64 & x86)
5. Achieving the boot process
6. How to mount Samba share when in WinPE and Install Windows 7
7. An extra note on how to do this with Windows 7 in VirtualBox
The assumptions we make through this are:
1. We have DHCP enabled on our network
2. We are not in an Active Directory or Domain Structure — I only make this assumption because where I did this we currently do not have a Domain System setup so the authentication could be substantially different
3. You have root access on the PXE server
4. That you have an extra Windows 7 around that you can do the required Windows tasks on (like generating the WinPE installation disks)
Installing TFTP & PXELinux on CentOS 5.6
The first and most core step. First, install TFTP if you do not have it installed. My PXE server was installed from a slim installation of CentOS through KickStart so it did not have the TFTP server installed
[pxe_server]$ yum install tftp
Once TFTP is installed we need to edit xinetd.d’s definition (/etc/xinetd.d/tftp) for TFTP to enable it
You will see it displayed as this

Modify the parameter of “disable” and set it to “no” as seen below

The installation of TFTP will make the default directory in /tftpboot
Restart xinetd
[pxe_server]$ service xinetd restart
TFTP will now be listening via xinetd for connections
Setting up PXELinux for booting WinPE
Now, as previously stated, I am running a slimed down version of CentOS so I also needed to install syslinux package too.
Note that this installs 3.11 and we will need to update the memdisk boot file to facilitate booting from ISO later on (it will be covered)
[pxe_server]$ yum install syslinux
Some of the directions below were copied and pasted from the CentOS how-to on PXE Booting setup to save me some time and to make it match my setup.
This will copy over all of the files from the syslinux package and place them into our TFTP directory that TFTP knows to serve up through its xinetd.d definition
[pxe_server]$ cp /usr/lib/syslinux/pxelinux.0 /tftpboot
[pxe_server]$ cp /usr/lib/syslinux/menu.c32 /tftpboot
[pxe_server]$ cp /usr/lib/syslinux/memdisk /tftpboot
[pxe_server]$ cp /usr/lib/syslinux/mboot.c32 /tftpboot
[pxe_server]$ cp /usr/lib/syslinux/chain.c32 /tftpboot
Now we need to create the pxelinux.cfg directory. You must use this directory name from the TFTP root directory because that is how the pxelinux.0 file knows where to look for the menu information.
[pxe_server]$ mkdir /tftpboot/pxelinux.cfg
Now lets create our boot directory structure. The below is an example and can be adjusted as you see fit. I like mine organized by /tftpboot/images/OS/ARCH/ as seen below:
I know this can be consolidated with a { .. } and -p but I am doing it line by line to show the hierarchy
Remember, these are not the distribution files. These are architecture dependent boot files that you will need entries for in the menu ( to be covered later )
[pxe_server]$ mkdir /tftpboot/images/
[pxe_server]$ mkdir /tftpboot/images/Windows_7
[pxe_server]$ mkdir /tftpboot/images/Windows_7/x86
[pxe_server]$ mkdir /tftpboot/images/Windows_7/x86_64
Upgrade SysLinux memdisk Image
Now, we need to upgrade our SysLinux package so our memdisk boot image can support loading ISO’s
Some other notes here:
1. I had to install the development tools through the groupinstall argument to yum.
2. I had to install nasm package for building the memdisk image
3. I had to install unzip
[pxe_server]$ yum groupinstall 'Development Tools'
[pxe_server]$ yum install unzip
[pxe_server]$ yum install nasm
[pxe_server]$ mkdir /root/syslinux-4.04
[pxe_server]$ cd /root/syslinux-4.04
[pxe_server]$ wget http://www.kernel.org/pub/linux/utils/boot/syslinux/4.xx/syslinux-4.04.zip
[pxe_server]$ unzip syslinux-4.04.zip
[pxe_server]$ cd memdisk
[pxe_server]$ make
[pxe_server]$ cp memdisk /tftpboot/images/Windows_7/x86_64/
[pxe_server]$ cp memdisk /tftpboot/images/Windows_7/x86/
Configure DHCP
Again, with the minimal installation, I had to install DHCP server daemon
[pxe_server]$ yum install dhcp
I will display my file here with the necessary notes that you will (or should) make to facilitate your network.
Most stuff here is semantic but the field you must change here is “next-server” which should be your servers IP. You can toy with everything else later.
[pxe_server]$ vi /etc/dhcpd.conf
ddns-update-style none;
site-option-space "pxelinux";
option space pxelinux;
option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;
shared-network "fixflyer.int"
{
subnet 192.168.1.0 netmask 255.255.255.0
{
# Setup your domain name, your routers gateway IP, and
# any DNS servers you should use by default when DHCP assigns the network to the connecting client.
# If your using an 192.168.1.0/24 IP subnet then you can
# probably just remove the first DNS server and leave the rest (maybe change domain name?)
option domain-name "fixflyer.int";
option routers 192.168.1.1;
option domain-name-servers 192.168.1.70, 4.2.2.2, 4.2.2.1;
allow bootp;
allow booting;
use-host-decl-names on;
range 192.168.1.230 192.168.1.250;
# This IP for "next-server" should be your servers IP
next-server 192.168.1.102;
filename "/pxelinux.0";
}
}
Restart DHCP
[pxe_server]$ service dhcpd restart
At this point you should be able to at least attempt a PXE Boot but be served with an error stating can not boot from kernel (or something of the similar).
Setting up Samba and the files to use to install Windows 7
Some assumptions here:
1. You have a working ISO for Windows 7 that you have already tested and installed from
2. You have a capable method/way of transferring this ISO to your PXE server (if you’re on Windows, look at winscp — if you’re on Linux, man scp )
3. We are using the /dist directory as our files distribution directory
First you need to copy the ISO. Assuming we are running on Linux and the file is located at /root/windows7.iso, lets execute an SCP. 192.168.1.102 is the IP of my server but make sure to change it to yours
[your_desktop] $ scp /root/windows7.iso root@192.168.1.102:/root/
Now that the file is there, lets make sure we’re back operating on the PXE server. From the PXE server, execute the following:
[pxe_server] $ mkdir /mnt/iso
[pxe_server]$ mount -t iso9660 -o loop /root/windows7.iso /mnt/iso
Now we have the ISO mounted. We must copy the files from here to our “distribution” directory which will be used to house the files for distribution through Samba. Samba is required because we need a way to serve the files to Windows — Samba is how you do this.
The Windows 7 installer I have is architecture independent and allows me to pick what architecture I want to install– therefore, my directory hierarchy is configured as such
[pxe_server]$ mkdir /dist
[pxe_server]$ mkdir /dist/OS
[pxe_server]$ mkdir /dist/Windows
[pxe_server]$ mkdir /dist/Windows/7
[pxe_server]$ cp -Rv /mnt/iso/* /dist/Windows/7/
[pxe_server]$ umount /mnt/iso
Now we have all of the files stored locally on our server and it is time to setup Samba. I had to install this as well:
[pxe_server]$ yum install samba
I made some changes to the configuration file (/etc/samba/smb.conf) that I will note below. I will also supply a picture of my file with all of the commented lines removed so you can see what it should look like in its entirety
This will be displayed as:
ORIGINAL_SETTING => MODIFIED_SETTING
If there was a comment in front of (like the interfaces line below) then I showed the modified value to remove the comment
security = user => security = share
# interfaces = lo eth0 [...] => interfaces = lo eth0
# netbios name = MYSERVER => netbios name = MYSERVER
passdb backend = tdbsam => # passdb backend = tdbsam
I also appended the following lines. These following lines will make our /dist/OS/Windows/7 directory mountable later on
[Windows7PXE]
comment = Windows 7 PXE DVD Install Files
path = /dist/OS/Windows/7
only guest = yes
guest ok = yes
writable = no
guest account = nobody
public = yes
And a picture of my file to show you how my configuration looks

As you can see, I left most of the default configuration in because at this time I am not very concerned with it.
We use security = share because we want our share to handle the security parameters where we are telling it to allow guests. You may run into other problems/extra configuration steps if you wish to use any security backend or user backend
Now lets restart samba
[pxe_server]$ service samba restart
If you have that extra Windows PC laying around, go ahead and try to browse to share to make sure it is available.
192.168.1.102 is my IP so make sure you change that!
C:\ >net view \\192.168.1.102\
You should see something of the similar

Creating a WinPE disk image to boot (both AMD64 & x86)
Here comes the somewhat tricky part — I guess its most of an annoying part than it is a tricky part. I could probably supply the ISO’s but Microsoft may get mad (eh?) about that so I will do my best to document this. If anyone needs the ISO’s that I was able to boot with, please email me or message me and I will be happy to get them to you.
1. First, install the Windows Automated Installation Pack — this can be found from: The Windows Download Site — You will need to verify with Microsoft After Clicking This — the bad part about this is it downloads an IMG file which will need to be burned to a disk and installed. I already had this installed on my system from a previous time so I did not have to do this step
2. Once you have these installed navigate the following
Start -> All Programs -> Microsoft Windows AIK -> "Deployment Tools Command Prompt"
This is basically a shell that is just a command prompt with you automatically placed into the necessary directory to use all the tools you need to make a WinPE image and a bootable ISO
3. Once here, run the following commands in order. First I will cover making an x86 (32-bit) bootable ISO and then an AMD64 (x86_64 / 64-bit) bootable ISO
x86
C:\Program Files\Windows AIK\Tools\PETools > copype.cmd x86 c:\winpe_x86
C:\Program Files\Windows AIK\Tools\PETools > oscdimg -n -bc:\winpe_x86\etfsboot.com c:\winpe_x86\ISO c:\winpe_x86\winpe_x86.iso
Critical Step: This threw me off because Windows Technet documentation isnt all that great but you need to open your destination (c:\winpe_x86) and copy the winpe.wim file into ISO/sources/ and rename it to boot.wim and regenerate the ISO. More specifically do this
1. Open c:\winpe_x86
2. Select the winpe.wim file and type ctrl+c or right click and select “copy”
3. Double click ISO folder
4. Double click sources folder
5. Type ctrl+v or right click and select “paste”
6. Right click the newly pasted “winpe.wim” and rename to “boot.wim”
7. Execute (again): oscdimg -n -bc:\winpe_x86\etfsboot.com c:\winpe_x86\ISO c:\winpe_x86\winpe_x86.iso
Copy your newly created c:\winpe_x86\winpe_x86.iso to your PXEBoot server — preferably use WinSCP to place it into the root directory (I will use the assumption you copied it there later)
AMD64
C:\Program Files\Windows AIK\Tools\PETools > copype.cmd amd64 c:\winpe_amd64
C:\Program Files\Windows AIK\Tools\PETools > oscdimg -n -bc:\winpe_amd64\etfsboot.com c:\winpe_amd64\ISO c:\winpe_amd64\winpe_amd64.iso
Critical Step: This threw me off because Windows Technet documentation isnt all that great but you need to open your destination (c:\winpe_amd64) and copy the winpe.wim file into ISO/sources/ and rename it to boot.wim and regenerate the ISO. More specifically do this
1. Open c:\winpe_amd64
2. Select the winpe.wim file and type ctrl+c or right click and select “copy”
3. Double click ISO folder
4. Double click sources folder
5. Type ctrl+v or right click and select “paste”
6. Right click the newly pasted “winpe.wim” and rename to “boot.wim”
7. Execute (again): oscdimg -n -bc:\winpe_amd64\etfsboot.com c:\winpe_amd64\ISO c:\winpe_amd64\winpe_amd64.iso
Copy your newly created c:\winpe_amd64\winpe_amd64.iso to your PXEBoot server — preferably use WinSCP to place it into the root directory (/root) (I will use the assumption you copied it there later)
This image (winpe_x86.iso) are bootable Windows Preboot Environment images. These will bring you to nothing but a command window with the minimal services and network configuration running.
Achieving the Boot Process
Now, as previously stated, you should be able to PXE boot but be left with no graphical menu or the ability to really do anything. This is where that changes.
We need to create the menu file that the pxelinux.0 boot process can load to display a graphical menu to you. As I said above, you will have to create this inside the /tftpboot/pxelinux.cfg directory with the name of default . PXELinux requires the file be named exactly this in that directory.
There is not much I can do here but show you my menu (Picture updated 20110606)

A break down of the menu entries and what they mean are below:
# This says to load the menu.c32 file (as I noted above). This can be found in /tftpboot -- if you change this, it must be relative of /tftpboot
default menu.c32
# Your title
MENU TITLE PXE Network Installation (new)
# Your timeout in seconds (though for some reason mine no longer counts down)
timeout 300
# See above explanations
Label Windows 7 (Attended)
# kernel is the "kernel" or the disk image we are going to load. In this case, we are loading our updated/upgraded syslinux memdisk image
KERNEL images/Windows_7/x86/memdisk
# APPEND is what we are appending to the "kernel" parameters of memdisk. This says we are using an ISO (to load the ISO module)
# and our RAM disk is our AMD64 WinPE bootable ISO image
# The real path for this is /tftpboot/images/Windows_7/x86/
APPEND iso initrd=images/Windows_7/x86/winpe_x86.iso
Now, we must copy the image files from the /root directory into the above mentioned paths relative to that of /tftpboot. So, execute the following:
[pxe_server]$ cp /root/winpe_x86.iso /tftpboot/images/Windows_7/x86/winpe_x86.iso
[pxe_server]$ cp /root/winpe_amd64.iso /tftpboot/images/Windows_7/x86_64/winpe_amd64.iso
Now, you should be able to PXEBoot successfully
If all goes well you should see a screen that looks like the following

Selecting the 32-bit one, you should see a successful boot beginning like this

Then you should be prompted with the “Press any key to boot from CD”. You should only be prompted with this if you have a drive with data/OS on it already
How to mount Samba share when in WinPE and Install Windows 7
Assuming you’ve made it this far, you’re doing great! If not, please don’t hesitate to ask any questions!
Now you are inside of WinPE.

Now, remember your IP of your PXE server and the share name we setup with Samba? Well, now we need to mount it by using the “net use” command. One silly part on this is that you must supply a username and password even if its bogus! If you don’t you will be prompted with an error saying the “server service” is not started– that service is used to browse networks/computers and is somewhat useless in the eyes of WinPE. But, since we’re not browsing and we know where we want to go, execute the following:
Note that my IP is 192.168.1.102 — change this to yours
net use k: \\192.168.1.102\Windows7PXE anon /user:192.168.1.102\anon
If all goes well you should see a message that says the command executed successfully and then be able to change directories to K:\ by simply typing
As displayed below

Now, execute setup.exe by simply typing
And you will be prompted with the Windows 7 installation Window.

And this point the installation is pretty generic. You will be able to partition the disk from within here and kick off the installation. After that, once the system installs you will be at a successful initial configuration screen to input a username and password.
An extra note on how to do this with Windows 7 in VirtualBox
I wanted to test this thing out in a Virtual Machine rather than getting up and down to go back into the datacenter in the office. Well, heres a couple issues
1. VirtualBox has a number of separate devices it can emulate — AMD PcNet II/III and 3 types of Intels
2. Windows 7 does not support AMD PcNet and finding drivers for it to inject into the WinPE image is near impossible
3. The Intel devices fail to boot
4. Windows 7 does have built-in support for the Intel devices
What to do?
Simple!
Setup two NIC cards — one to use the AMD PcNet III so you can PXE boot and the other for the Intel Desktop so you can get an IP from with WinPE natively!
Select the AMD PcNet Card for the Primary:

Select the Intel for the Secondary:

Boot and Press F12 to get to the boot menu and then press L then obtain the PXE Menu

And confirm you have an IP!

This tripped me up but then I slapped my forhead and went “duuurrrr” and realized I could just use two NICs!
That concludes this tutorial/document. If you have any questions please do not hesitate to ask. I will surely answer them as fast as I can!
I have used the following resources:
Initial PXE Resources for CentOS (This document is horrible): http://wiki.centos.org/HowTos/PXE/PXE_Setup
Got me started: http://www.savelono.com/linux/how-to-install-windows-7-over-a-network-using-linux-pxe-dnsmasq-and-samba.html
Sphere: Related Content