Setting Up Prerequisites to ‘Install Windows 7’ over ‘PXE Network Boot Server’ on RHEL/CentOS 7 – Part 1

Continuing the series of tutorials regarding RHEL/CentOS 7 PXE Network Boot Server Environment, where so far I have only discussed integrating and installing Linux distributions over PXE Server.

Configure PXE Server to Install Windows

Configure PXE Server to Install Windows

This tutorial will be concentrate around Windows based systems and will show you how to add and manually install Windows 7, both 32-bit and 64-bit architectures, over a PXE Server and Samba shares.

Requirements

  1. Install PXE Network Boot Server for Multiple OS Installations in RHEL/CentOS 7
  2. A Samba fully accessed directory share setup on PXE Server machine.
  3. A computer with Windows 7 operating system installed.
  4. Windows Automated Installation Kit (AIK) installed on Windows 7 computer.
  5. Both Windows 7 32-bit/64-bit DVD ISO Images.

Before proceeding with the installation process, I will explain how this guide is structured.

The first part will cover the configurations needed to setup the environment on RHEL/CentOS 7 PXE Server premises, by installing and configuring a Samba fully accessed shared directory with no authentication needed, where both Windows 7 system architecture images will be deployed, and, also, editing PXE Server default configuration file with the options needed to boot WinPE ISO Image in order to manually proceed with Windows installation process.

The second part will be focused on building WinPE ISO image (Windows Preinstallation Enironment) with the help of Windows Automated Installation Kit (AIK) installed on a Windows 7 computer premises. This image will be then transferred to PXE Server machine via Samba shared directory and moved to TFTP server default location.

The next steps that should be made on the client-side in order to boot, access and install Windows 7 over network.

Step 1: Install and Setup Samba Share on PXE Server

1. On the first step, login to PXE Server with root account and setup a fully accessed Samba share, where Windows 7 DVD installation sources will be deployed. Install Samba daemon by issuing the following command.

# yum install samba samba-common samba-winbind 
Install Samba on CentOS 7

Install Samba on PXE

2. Next, backup samba main configuration file and create a new configuration file with your favourite text editor by running the following commands.

# mv /etc/samba/smb.conf /etc/samba/smb.conf.backup
# nano /etc/samba/smb.conf
Backup Samba Configuration

Backup Samba Configuration

3. Now add the following configurations to samba main file as presented in the below file excerpt.

[global]
        workgroup = PXESERVER
        server string = Samba Server Version %v
        log file = /var/log/samba/log.%m
        max log size = 50
        idmap config * : backend = tdb
        cups options = raw
        netbios name = pxe
        map to guest = bad user
        dns proxy = no
        public = yes
        ## For multiple installations the same time - not lock kernel
        kernel oplocks = no
        nt acl support = no
        security = user
        guest account = nobody

[install]
        comment = Windows 7 Image
        path = /windows
        read only = no
        browseable = yes
        public = yes
        printable = no
        guest ok = yes
        oplocks = no
        level2 oplocks = no
        locking = no
Configure Samba in CentOS 7

Configure Samba for PXE

As you can see from this configuration file, I have created a shared folder named install which is located under /windows system path (on this path will copy Windows 7 DVD installation sources).

4. After finishing editing main samba configuration file run testparm command in order to check and validate the file for eventual errors or misconfigurations.

# testparm
Check Samba Configuration

Check Samba Configuration

5. On the next step create the /windows directory under root path (the directory defined in samba conf file) and add SELinux contextual rules in
order to be fully accessed in case your system has enforced SELinux security.

# mkdir /windows
# semanage fcontext -a -t samba_share_t ‘/windows(/.*)?’
# restorecon -R -v /windows
Add Samba Selinux Rules

Add Samba Selinux Rules

Step 2: Deploy Windows 7 Installation Sources on PXE Server

6. For this step both Windows 7 ISO DVD Images are needed. But before mounting and copy DVD content create two directories under /windows path
to separate Windows installation sources architectures.

# mkdir /windows/x32
# mkdir /windows/x64
Create Windows Install Sources on PXE

Create Windows Install Sources on PXE

7. Now it’s time to copy Windows Installation Sources to the paths created above. First put Windows 7 32-bit DVD Image ISO on your machine DVD drive, mount the image to /mnt path and copy all DVD mounted content to samba shared directory /windows/x32/. The transfer process can take a while depending on your system resources, and, after it finishes, unmount Windows 7 32-bit DVD Image.

# mount -o loop /dev/cdrom /mnt
# cp -rf  /mnt/*  /windows/x32/
# umount  /mnt
Mount Windows Install DVD on PXE

Mount Windows Install DVD on PXE

8. Repeat the above process with Windows 7 64-bit DVD Image, but this time copy DVD mounted content to /windows/x64/ shared path.

# mount -o loop /dev/cdrom /mnt
# cp -rf  /mnt/*  /windows/x64/
# umount  /mnt
Mount Windows 7 64 bit on PXE

Mount Windows 7 64 bit on PXE

Note: If your PXE server machine doesn’t have a DVD drive you can copy both Windows DVDs contents after you start samba server and access the “install” shared folder from a Windows computer.

9. After both DVD’s images are copied, issue the following commands to setup the right owner and permissions in order to make the share readable and fully accessible without authentication.

# chmod -R 0755 /windows
# chown -R nobody:nobody /windows
Grant Permission Windows Install Sources

Grant Permission Windows Install Sources

Step 3: Add Firewall Rules, Start and Enable Samba System-Wide

10. If you are using a Firewall on your PXE Server premises, add the following rule to Firewalld service to open Samba to outside connections.

# firewall-cmd --add-service=samba --permanent
# firewall-cmd --reload
Open Samba in Centos 7 Firewall

Open Samba on Firewall

11. Now, start Samba daemons and enable it system wide, to automatically start after every reboot, by issuing the following commands.

# systemctl restart smb
# systemctl enable smb
# systemctl restart winbind
# systemctl enable winbind
# systemctl restart nmb
# systemctl enable nmb
# systemctl status smb
Enable Samba Systemwide in CentOS 7

Enable Samba Systemwide

12. To test Samba configuration move to a Windows computer and add the IP Address of your Samba server followed by the shared path name in Windows Explorer address bar and the shared folders should appear.

\192.168.1.20\install
Check Samba Shares in CentOS 7

Check Samba Shares

At this point you can now use the alternate method explained in the above note, and put Windows 7 ISO Images in your DVD drive and copy their content, depending on the system architecture, to x32 and x64 folders.

Step 4: Configure PXE Server

13. Before editing PXE Menu configuration file, create a new directory named windows on TFTP server default system path. Under this directory you will later copy WinPE ISO image, created on the Windows 7 computer using Windows Automated Installation Kit program.

# mkdir /var/lib/tftpboot/windows

14. Now, open PXE Server default configuration file and add Windows Installation label to PXE menu, as described in the below menu excerpt.

# nano /var/lib/tftpboot/pxelinux.cfg/default

Windows 7 menu label configuration.

label 9
menu label ^9) Install Windows 7 x32/x64
                KERNEL memdisk
                INITRD windows/winpe_x86.iso
                APPEND iso raw
Add Windows 7 to PXE Menu

Add Windows 7 to PXE Menu

That’s all you need to setup on RHEL/CentOS 7 PXE Server side. Still, don’t close the console yet, because you will need it later to copy WinPE ISO image to /var/lib/tftpboot/windows/ directory.

Further let’s continue with the procedure and move onto a Windows 7 Installation on PXE Network – Part 2 of this series, and don’t forget to give your valuable feedback about the article.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Matei Cezar

I'am a computer addicted guy, a fan of open source and linux based system software, have about 4 years experience with Linux distributions desktop, servers and bash scripting.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide
The Complete Linux System Administrator Bundle
Become an Ethical Hacker Bonus Bundle

You may also like...

23 Responses

  1. oasejoul says:

    Help, when I type the command:

    # semanage fcontext -a -t samba_share_t ‘/windows(/.*)?’
    

    There is an error message ==>

    -bash: syntax error near unexpected token `('
    

    What should I do. Thank you for the help

  2. radhe says:

    Hi,

    I have configured this for windows 2012R2, while trying to connect with samba i am getting “System error 58 ha occurred“.

    From other windows or Linux server i am able to connect, But from WinPe i am getting error.

  3. SanBarn says:

    Hi,

    Can you please provide the similar steps for UEFI mode? Means I need to install WIndows 10 on UEFI mode using similar Linux PXE server.

  4. Suprio Mukherjee says:

    Hi !
    Can you mention the configurations changes in if I have no control over DHCP (DHCP server is configured in Cisco switches) and DNS server? Can we configure Linux and Windows PXEBoot server in same box?

    • Matei Cezar says:

      You can disable dhcp service on cisco and configure dhcp, pxe server and all required repos on a linux box. Why the cisco switch is not under your control since it operates on your network?

    • Matei Cezar says:

      The winpe image doesn’t recognize your system network interface card. You should consult microsoft docs to add nic’s drivers into winpe bootable image.

  5. Lee Logan says:

    I would like to use this and use the rescue cd to access a WindowsBackupImage. I already have samba set up and am backing up my windows to that share. Can this be done. I already have a rescue cd built as well.
    Thanks in advance.

  6. ashutosh says:

    hello..
    i’m trying install windows 7 through linux pxe server.. but after kernel load show window logo and open cmd … so what is next step for successfully installing win. i;m using winpe_amdiso aik

  7. Bik says:

    Do I have to move the winPE via the samba shared directory or can I download it from the web into the shared directory?

    • Matei Cezar says:

      You can move the WinPE image to the shared directory using any protocol or method as you like! You can use http, ftp, smb, nfs, with local usb stick, cd/dvd, rsync, scp, ….you name it! It has no importance how you copy the winPE image, it’s important to be there!

  8. Rohan says:

    Also i am facing the same issue like #Bruno i can see shared folder install but unable access that folder getting error you don’t have sufficient
    privilege to access this folder

    • Matei Cezar says:

      Try to change samba shared folder permissions with chmod -R 777 /windows, and if that doesn’t work add a samba user with smbpasswd -a system_user, restart samba daemon and login with smba user credentials from windows cmd (net use Q : \\192.168.1.20\install /user:samba_username)

      • Joe says:

        So I followed these instructions and the instructions on setting up the PXE server. I can get Centos to install but when I select the install windows 7 option from the PXE boot menu, PXE is unable to find the windows ISO.

        I have checked and rechecked the config files and file placement on my server. Any ideas?

        Thanks,
        Nick”

        I’m having the same problem. after loading memdisk, Client computer showing:

        "Could not find ramdisk image: win7x32/winpe_x86.iso"
        

        I have checked and re-checked the file locations and placement/naming.

        Any ides for a solution?

  9. nick says:

    So I followed these instructions and the instructions on setting up the PXE server. I can get Centos to install but when I select the install windows 7 option from the PXE boot menu, PXE is unable to find the windows ISO.

    I have checked and rechecked the config files and file placement on my server. Any ideas?

    Thanks,
    Nick

    • Ravi Saive says:

      @nick,
      Are you able to view Windows 7 share folders of samba from any windows machine? If you able view them then they must available to install..

      • Joe says:

        No Ravi. Nick not referring to the samba shared files. He’s referring to WinPE_x86.iso file located in /var/lib/tftpboot/windows.

        I’m having the same problem, Nick is having memdisk starts then client computer shows error:

        "Could not find ramdisk image: win7x32/winpe_x86.iso"
        

        I’m looking for a solution now.

  10. Bruno says:

    Hi !

    I tried to install windows with your method (who very help me), but for an unknown reason, the samba share doesnt work. My smb.conf is exatly like your (with my own workgroup and folder to share).

    When i try to connect from a Windows PC, it say me “access denied” but only for the path “install”, i can browse the host (where i have only “install”)

    I used CentOS 7 for the server and windows vista to access this server, i’ve not idea why this dont work and i guess you can help me.

    Finaly, sorry if my english is bad, i’m a french student

    Cordialy

    • Kenneth says:

      9. After both DVD’s images are copied, issue the following commands to setup the right owner and permissions in order to make the share readable and fully accessible without authentication.

      # chmod -R 0755 /windows – R
      # chown -R nobody:nobody /windows – R

      smb.conf
      [install]
      comment = Windows 7 Image
      path = /windows
      read only = no
      browseable = yes
      public = yes
      printable = no
      guest ok = yes
      oplocks = no
      level2 oplocks = no
      locking = no

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.