When installing Windows 10, It was troublesome to make a USB memory and prepare a CD drive, so I installed it using PXE.
First, I will briefly introduce the technical elements used this time.
** PXE (Preboot eXecution Environment) ** is a mechanism for clients to acquire software from the network and execute it. This PXE client function is implemented in common NICs and can be used for OS installation, etc. Wikipedia
iPXE is an open source network boot firmware. In addition to the PXE client function, some functions have been added.
For details, see This page.
The important thing to use this time is that you can get the software via HTTP and start it.
** WinPE (Windows PE) ** is a small OS that can be used for deploying Windows OS. Functions are limited compared to normal Windows.
This time, we will combine these technologies to install the Windows OS. In the end, it looks like this.
Prepare one Linux server for installation. This time, it is assumed that the new personal computer and the Linux server are connected by L2, and other hosts are not connected.
First, we will create a Linux server.
This time, I prepared a VM of ** Fedora 33 WorkStation **.
[[email protected] ~]$ cat /etc/fedora-release Fedora release 33 (Thirty Three)
Set the interface to the static IP address ** 192.168.0.1/24 **. (Internet connection is required to install various software, so it may be necessary to switch back to DHCP depending on the environment.)
[[email protected] ~]$ ip a sh ens3 2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 52:54:00:28:c1:a9 brd ff:ff:ff:ff:ff:ff altname enp0s3 inet 192.168.0.1/24 brd 192.168.0.255 scope global noprefixroute ens3 valid_lft forever preferred_lft forever inet6 fe80::da34:251a:af7d:962d/64 scope link noprefixroute valid_lft forever preferred_lft forever
First, set up a DHCP server and a TFTP server.
The dnsmasq used this time has a TFTP server function, but it is not used. Install tftpd separately.
#It was included in dnsmasq when Fedora was installed. $ rpm -q dnsmasq dnsmasq-2.82-3.fc33.x86_64 $ sudo vi /etc/dnsmasq.conf <Described below> $ sudo firewall-cmd --add-service dhcp $ sudo systemctl start dnsmasq
#Change the interface to the required interface. interface=ens3 #Appropriate dhcp-Comment out the range. dhcp-range=192.168.0.50,192.168.0.150,12h #Comment out the settings related to iPXE. #3rd line, dhcp returned to iPXE-Change boot to the URL of the script. The script will be created later. dhcp-boot=undionly.kpxe dhcp-match=set:ipxe,175 # iPXE sends a 175 option. dhcp-boot=tag:ipxe,http://192.168.0.1/boot.ipxe
#This time, get iPXE from Fedora Repository. $ sudo dnf install ipxe-bootimgs $ rpm -ql ipxe-bootimgs /usr/share/doc/ipxe-bootimgs /usr/share/doc/ipxe-bootimgs/COPYING /usr/share/doc/ipxe-bootimgs/COPYING.GPLv2 /usr/share/doc/ipxe-bootimgs/COPYING.UBDL /usr/share/ipxe /usr/share/ipxe/ipxe-i386.efi /usr/share/ipxe/ipxe-x86_64.efi /usr/share/ipxe/ipxe.dsk /usr/share/ipxe/ipxe.iso /usr/share/ipxe/ipxe.lkrn /usr/share/ipxe/ipxe.usb /usr/share/ipxe/undionly.kpxe # <-Use this. $ sudo dnf install tftp-server $ sudo firewall-cmd --add-service tftp $ sudo systemctl start tftp $ sudo cp /usr/share/ipxe/undionly.kpxe /var/lib/tftpboot/
If you do so far, you should be able to confirm until iPXE starts.
Now create WinPE. There is a way to create it on Windows, but this time I will try to create it on Linux using ** wimlib **.
At this point, you need a disk image (ISO file) for installing Windows, so download it from Microsoft official and place it on your Linux server.
#For the English version. $ ls Win10_20H2_v2_English_x64.iso Win10_20H2_v2_English_x64.iso
# wimlib-Install utils and syslinux. $ sudo dnf install wimlib-utils $ sudo dnf install syslinux #Specify the command when starting WinPE. $ vi boot.cmd <Described below> #Mount the installer appropriately. $ sudo mount Win10_20H2_v2_English_x64.iso /mnt $ mkwinpeimg -W /mnt -a amd64 -s boot.cmd winpe.img #Unmount it. $ sudo umount /mnt
boot.cmd file created above.
** Username (testing in the example) is a Linux username,
The password (password in the example) will be the Samba password that you will specify later. ** **
wpeinit ping -n 10 localhost net use n: \\192.168.0.1\testing password /user:testing n:\installer\setup.exe
You have now created an image of WinPE.
It may be puzzling to have
ping -n 10 localhost, but it is intended for
This is a painstaking measure because an error will occur if the network settings are not completed when executing
net use ...
This time I will use Nginx.
$ sudo dnf install nginx $ sudo firewall-cmd --add-service http $ sudo systemctl start nginx
Place the files needed to start WinPE. Suddenly, I use software called wimboot.
$ wget http://git.ipxe.org/releases/wimboot/wimboot-latest.zip $ unzip wimboot-latest.zip $ sudo cp <Extracted directory>/wimboot /usr/share/nginx/html/
Extract the required files from the WinPE image and place them.
$ sudo mount winpe.img /mnt/ $ sudo cp -r /mnt/boot /mnt/sources /usr/share/nginx/html
Finally, create an iPXE script file. (I referred to the wimboot page.)
#Match the file name returned by DHCP. $ sudo vi /usr/share/nginx/html/boot.ipxe
#!ipxe kernel wimboot initrd boot/bcd BCD initrd boot/boot.sdi boot.sdi initrd sources/boot.wim boot.wim boot
Hopefully you can see WinPE booting at this point.
Next, set up Samba.
$ sudo dnf install samba #Set a password. Make it the same as the user name and password described when creating WinPE. $ sudo smbpasswd -a -U testing New SMB password: Retype new SMB password: Added user testing. $ sudo firewall-cmd --add-service samba $ sudo systemctl start smb
Makes it possible to refer to the windows installer. This time we will use the home directory.
$ sudo setsebool -P samba_enable_home_dirs=on $ cd #Match the path described when creating WinPE. $ mkdir installer $ sudo mount -o context=user_u:object_r:user_home_t:s0 Win10_20H2_v2_English_x64.iso installer/ $ ls installer/ autorun.inf boot bootmgr bootmgr.efi efi setup.exe sources
This completes the Linux server settings.
I will install it. After connecting properly, start a new computer and wait for the installer to start. After the installer starts, it's almost as usual. (If necessary, change the Boot Order at boot time.)
To give an example, let's try it on a virtual machine.
--First, iPXE boots from PXE. (This virtual machine does not have this because iPXE starts from the beginning.) --Next, iPXE gets the script over HTTP and executes it. --WinPE will start. --WinPE connects to Samba and launches the installer. ――The rest is the same as usual. (It seems that some options cannot be selected.)
The installation was completed like this.
I think it was faster to buy a cheap USB memory because it was so clogged. However, it is still fun to start the actual machine with PXE.
The main software versions used this time are listed.
$ rpm -q dnsmasq dnsmasq-2.82-3.fc33.x86_64 $ rpm -q tftp-server tftp-server-5.2-31.fc33.x86_64 $ rpm -q nginx nginx-1.18.0-3.fc33.x86_64 $ rpm -q samba samba-4.13.3-0.fc33.x86_64 $ rpm -q ipxe-bootimgs ipxe-bootimgs-20200823-1.git4bd064de.fc33.noarch $ rpm -q wimlib-utils wimlib-utils-1.13.3-1.fc33.x86_64