Configure CentOS 7 PXE Server to Install Ubuntu 18.10 - CentLinux


Saturday, 17 November 2018

Configure CentOS 7 PXE Server to Install Ubuntu 18.10

Configure CentOS 7 PXE Server to Install Ubuntu 18.10

In our previous posts, we have configured a PXE boot server that supports both BIOS and UEFI based clients. We have also configured our CentOS 7 PXE server to install RHEL 6 and RHEL 7 operating systems using Kickstart. Now, we will configure our CentOS 7 PXE server to install Ubuntu 18.10.

We will also create a Kickstart file for automated installation of Ubuntu 18.10 operating system, and ensure that it will support both BIOS and UEFI based clients.

Note: In this article, we are performing everything from CLI, therefore, it is highly recommended that, you should have Linux Pocket Guide: Essential Commands for quick reference.


This Article Provides:


    System Specification:

    We use the same CentOS 7 machine that we have configured as PXE Boot Server in our previous article. These specifications have been re-mentioned below for convenience of the readers.

    • CPU - 2 Core (2.4 Mhz)
    • Memory 2 GB
    • Storage - 50 GB
    • Operating System - CentOS 7.5
    • Hostname -
    • IP Address -


    Share Ubuntu 18.10 ISO/DVD contents via NFS Server:

    Connect to using ssh as root user.

    Install NFS packages using yum command.

    [root@pxe-server ~]# yum install -y nfs-utils Loaded plugins: product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. localyum | 4.3 kB 00:00 Resolving Dependencies --> Running transaction check ---> Package nfs-utils.x86_64 1:1.3.0-0.54.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: nfs-utils x86_64 1:1.3.0-0.54.el7 localyum 407 k Transaction Summary ================================================================================ Install 1 Package Total download size: 407 k Installed size: 1.0 M Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:nfs-utils-1.3.0-0.54.el7.x86_64 1/1 Verifying : 1:nfs-utils-1.3.0-0.54.el7.x86_64 1/1 Installed: nfs-utils.x86_64 1:1.3.0-0.54.el7 Complete!

    Start and Enable NFS service.

    [root@pxe-server ~]# systemctl start nfs-server [root@pxe-server ~]# systemctl enable nfs-server Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/nfs-server.service.

    Create a directory for sharing Ubuntu 18.10 ISO.

    [root@pxe-server ~]# mkdir /nfsshare [root@pxe-server ~]# chown nfsnobody:nfsnobody /nfsshare

    Allow NFS and relevant ports in CentOS 7.5 Firewall.

    [root@pxe-server ~]# firewall-cmd --permanent --add-service={nfs,mountd,rpc-bind} success [root@pxe-server /]# firewall-cmd --reload success

    Adjust SELinux Permissions.

    [root@pxe-server /]# semanage fcontext --add -t nfs_t '/nfsshare(/.*)?' [root@pxe-server /]# restorecon -Rv /nfsshare/ restorecon reset /nfsshare context unconfined_u:object_r:var_t:s0->unconfined_u:object_r:nfs_t:s0

    Export /nfsshare directory for all clients.

    [root@pxe-server /]# echo "/nfsshare *(ro)" >> /etc/exports [root@pxe-server /]# exportfs -r

    Attach Ubuntu 18.10 Server ISO/DVD and mount it at /mnt/iso (you can use any mountpoint, according to your choice).

    [root@pxe-server ~]# mount -t iso9660 /dev/cdrom /mnt/iso mount: /dev/sr0 is write-protected, mounting read-only

    Copy contents of /mnt/iso directory to NFS server.

    [root@pxe-server ~]# cp -rf /mnt/iso /nfsshare/ubuntu18


    Create a Kickstart file for automated installation of Ubuntu 18.10:

    We have to write a Kickstart file for Ubuntu 18.10 within the /nfsshare/ubuntu18/preseed/ directory, so it can be accessed by PXE clients via NFS service.

    [root@pxe-server ~]# vi /nfsshare/ubuntu18/preseed/ubuntu.seed

    A sample kickstart file is given below, you can modify it according to your requirements.

    # Enable d-i apt-setup/extras boolean true # Install the Ubuntu desktop. tasksel tasksel/first multiselect ubuntu-desktop # On live DVDs, don't spend huge amounts of time removing substantial # application packages pulled in by language packs. Given that we clearly # have the space to include them on the DVD, they're useful and we might as # well keep them installed. ubiquity ubiquity/keep-installed string icedtea6-plugin #System language lang en_US #Language modules to install langsupport en_US #System keyboard keyboard us #System mouse mouse #System timezone timezone Asia/Karachi #Root password rootpw --disabled #Initial user (user with sudo capabilities) user ubuntu --fullname "ahmer" --password ahmer1234 #Reboot after installation reboot #Use text mode install text #Install OS instead of upgrade install #Installation media nfs --server= --dir=/nfsshare/ubuntu18/ #System bootloader configuration bootloader --location=mbr #Clear the Master Boot Record zerombr yes #Partition clearing information clearpart --all --initlabel #Basic disk partition part / --fstype ext4 --size 1 --grow --asprimary part swap --size 1024 part /boot --fstype ext4 --size 256 --asprimary #System authorization infomation auth --useshadow --enablemd5 #Network information network --bootproto=dhcp --device=eth0 #Firewall configuration firewall --disabled --trust=eth0 --ssh


    Copy boot images to tftpboot directory:

    The Boot images in the Ubuntu ISO won’t work for network boot  Therefore, we downloaded netboot images from Ubuntu website.

    [root@pxe-server ~]# wget --2018-11-17 11:09:13-- Resolving (,,, ... Connecting to (||:80... connected. HTTP request sent, awaiting response... 200 OK Length: 56245393 (54M) [application/x-gzip] Saving to: ânetboot.tar.gz.1â 100%[======================================>] 56,245,393 179KB/s in 7m 23s 2018-11-17 11:16:40 (124 KB/s) - ânetboot.tar.gz.1â saved [56245393/56245393]

    Extract download TARBall.

    [root@pxe-server ~]# mkdir netboot [root@pxe-server ~]# tar xvf netboot.tar.gz -C netboot ./ ./ldlinux.c32 ./pxelinux.cfg ./ubuntu-installer/ ./ubuntu-installer/amd64/ ./ubuntu-installer/amd64/linux ./ubuntu-installer/amd64/boot-screens/ ./ubuntu-installer/amd64/boot-screens/txt.cfg ./ubuntu-installer/amd64/boot-screens/f2.txt ./ubuntu-installer/amd64/boot-screens/ldlinux.c32 ./ubuntu-installer/amd64/boot-screens/f8.txt ./ubuntu-installer/amd64/boot-screens/libcom32.c32 ./ubuntu-installer/amd64/boot-screens/f10.txt ./ubuntu-installer/amd64/boot-screens/prompt.cfg ./ubuntu-installer/amd64/boot-screens/f3.txt ./ubuntu-installer/amd64/boot-screens/rqtxt.cfg ./ubuntu-installer/amd64/boot-screens/syslinux.cfg ./ubuntu-installer/amd64/boot-screens/f1.txt ./ubuntu-installer/amd64/boot-screens/f5.txt ./ubuntu-installer/amd64/boot-screens/f4.txt ./ubuntu-installer/amd64/boot-screens/menu.cfg ./ubuntu-installer/amd64/boot-screens/adtxt.cfg ./ubuntu-installer/amd64/boot-screens/f7.txt ./ubuntu-installer/amd64/boot-screens/stdmenu.cfg ./ubuntu-installer/amd64/boot-screens/libutil.c32 ./ubuntu-installer/amd64/boot-screens/splash.png ./ubuntu-installer/amd64/boot-screens/exithelp.cfg ./ubuntu-installer/amd64/boot-screens/f9.txt ./ubuntu-installer/amd64/boot-screens/vesamenu.c32 ./ubuntu-installer/amd64/boot-screens/f6.txt ./ubuntu-installer/amd64/pxelinux.cfg/ ./ubuntu-installer/amd64/pxelinux.cfg/default ./ubuntu-installer/amd64/initrd.gz ./ubuntu-installer/amd64/pxelinux.0 ./ ./pxelinux.0

    We need to copy initrd.gz and linux files from netboot directory ~/netboot/ubuntu-installer/amd64/ to /var/lib/tftpboot/networkboot/ubuntu18 directory. These files will be referenced in the menu entry of PXE boot menu.

    [root@pxe-server ~]# mkdir /var/lib/tftpboot/networkboot/ubuntu18 [root@pxe-server ~]# cp ~/netboot/ubuntu-installer/amd64/{linux,initrd.gz} /var/lib/tftpboot/networkboot/ubuntu18/


    Create Menu Entries for Ubuntu 18.10 installation:

    Edit PXE boot menu for BIOS based clients.

    [root@pxe-server ~]# vi /var/lib/tftpboot/pxelinux.cfg/default

    Add a menu entry for Ubuntu 18.10 installation therein.

    default vesamenu.c32 prompt 0 timeout 30 menu title Ahmer's PXE Menu label Install RHEL 7.5 kernel /networkboot/rhel7/vmlinuz append initrd=/networkboot/rhel7/initrd.img inst.repo= ks= label Install RHEL 6.0 (64-bit) kernel /networkboot/rhel6/vmlinuz append initrd=/networkboot/rhel6/initrd.img inst.repo= ks= label Install Ubuntu 18.10 Server menu label Install Ubuntu 18.10 Server kernel networkboot/ubuntu18/linux append vga=788 initrd=networkboot/ubuntu18/initrd.gz ks=nfs: --- quiet

    Edit PXE boot menu for UEFI based clients. For more information on UEFI, please refer to Add UEFI Support to PXE Server in CentOS 7.

    [root@pxe-server ~]# vi /var/lib/tftpboot/grub.cfg

    Add a menu entry for Ubuntu 18.10 installation in this file.

    set timeout=60 menuentry 'Install RHEL 7.5' { linuxefi /networkboot/rhel7/vmlinuz inst.repo= inst.ks= initrdefi /networkboot/rhel7/initrd.img } menuentry 'Install RHEL 6.0' { linuxefi /networkboot/rhel6/vmlinuz inst.repo= inst.ks= initrdefi /networkboot/rhel6/initrd.img } menuentry "Install Ubuntu 18.10 Server" { set gfxpayload=keep linuxefi /networkboot/ubuntu18/linux inst.repo=nfs: inst.ks=nfs: initrdefi /networkboot/ubuntu18/initrd.gz }

    Now, connect a BIOS based PXE client to network and boot it. It will display the following PXE boot menu.


    Similarly, connect a UEFI based PXE client to network and boot it. It will display the following PXE boot menu.


    We have successfully configured our CentOS 7 PXE boot server to install Ubuntu 18.10. You can also add other versions of Ubuntu in similar manner.


    1. Good morning i’m having a difficulties installing Ubuntu thorugh network share on client. I followed centos tutorial working like a charm. Then i configure kickstart.. made it automated install of centos working fine.. now i’m trying to do multi PXE boot server. So i’m following this guide. So my first question do i have to use NFS server? Can’t i use same vsftpd share? I made a directory in /var/ftp/pub/crntos for centos and for ubuntu i made /ubuntu to share the whole image.. i used your kickstart configuration and i made some changes in there based on my network. Actually PXE boot screen coming fine i select ubuntu from the list its starting the installaion.. it found the ip from dhcp and start. But getting some nameserver error. I wish i can post the image so i can get you the right error... can you please suggest if you understand the situation. I’m learner so you take your time whenever you get a chance. Thankyou

      1. Hi,
        Answers to your questions are:

        1) Yes, we can use FTP or HTTP instead of NFS.
        2) Please check the NFS command in your kickstart file. May be you have used a hostname in place of IP Address. Please use an IP Address and check again.

        If the problem persists then please contact me on Facebook.

    2. Can I make the PXE boot menu time longer? Say 30 seconds instead of 5?

      1. Yes, Please set timeout in /var/lib/tftpboot/pxelinux.cfg/default file.

    3. hello Sir,
      You have used here Ubuntu18.04 Server but i want Ubuntu 18.04 Desktop How i can do that??

    4. could not find kernel image vesamenu.c32

      1. vesamenu.c32 is in netboot.tar.gz. Please download netboot.tar.gz file, as mentioned above.

    5. Thank you for your post.

      ```menuentry "Install Ubuntu 18.10 Server" {
      set gfxpayload=keep
      linuxefi /networkboot/ubuntu18/linux inst.repo=nfs: inst.ks=nfs:
      initrdefi /networkboot/ubuntu18/initrd.gz
      saved me a lot of time

    6. I was trying to connect all parts together and i'm getting kernel command not found.

      1. Please discuss it in detail at our Facebook Page.