The next step in our PXE boot setup process is to build out the images required. Luckily, obtaining the boot images is quite easy—the kernel and packages are normally contained on the DVD ISO images for your chosen Linux distribution. Obviously, this can vary from distribution to distribution, so you will need to check this. In this chapter, we will show examples for Ubuntu Server and CentOS 7—these principles could also be applied to many Debian derivatives, Fedora, and Red Hat Enterprise Linux.
Let's make a start with the CentOS 7 image, as follows:
- First of all, download the latest DVD image from your nearest mirror—for example, the one shown in the following code block:
$ wget http://mirror.netweaver.uk/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso
- Once downloaded, mount the ISO image to a suitable location so that the files can be copied from it, as follows:
$ mount -o loop CentOS-7-x86_64-DVD-1810.iso /mnt
- Now, the network boot-capable kernel and initial RAMDisk image should be copied to a location of our choosing, under the TFTP server root.
The commands to achieve this on our test system are as follows:
$ mkdir /var/lib/tftpboot/EFIx64/centos7
$ cp /mnt/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/EFIx64/centos7/
- Finally, we need the web server we installed earlier to serve out the files for the installer—once the kernel and initial RAMDisk environment load, the rest of the environment will be served over HTTP, which is better suited to large data transfers. Again, we'll create a suitable subdirectory for our CentOS content, as follows:
$ mkdir /var/www/html/centos7/
$ cp -r /mnt/* /var/www/html/centos7/
$ umount /mnt
That's all there is to it! Once these steps have been completed, we'll repeat this process for our Ubuntu 18.04 Server boot image, as follows:
$ wget http://cdimage.ubuntu.com/releases/18.04/release/ubuntu-18.04.2-server-amd64.iso
$ mount -o loop ubuntu-18.04.2-server-amd64.iso /mnt
$ mkdir /var/lib/tftpboot/EFIx64/ubuntu1804
$ cp /mnt/install/netboot/ubuntu-installer/amd64/{linux,initrd.gz} /var/lib/tftpboot/EFIx64/ubuntu1804/
$ mkdir /var/www/html/ubuntu1804
$ cp -r /mnt/* /var/www/html/ubuntu1804/
$ umount /mnt
With these steps complete, we just have one more configuration stage to go before we can perform a network boot of our chosen operating system.
In the next section, we will configure the PXE boot server we have built so far, so as to boot from these installation images.