Ubuntu 18.04 – How to install Ubuntu Desktop through PXE – Part II

Hello World, 

In this previous post, we have demonstrated how to install and configure a PXE infrastructure that can be used to deploy Ubuntu Server edition through the network.  The previous post presented really a quick way to get you started. After playing around with Ubuntu Server deployment through PXE infrastructure, one of the next steps would be to try to do the same with Ubuntu Desktop image. Surprisingly, the process to achieve this was not that straight forward.  

So, let’s see what’s different between Ubuntu server and Ubuntu Desktop when deploying them through PXE…..

 

IMPORTANT NOTE

In this post, we will continue our journey into the PXE installation process but this time for Ubuntu Desktop Edition.  In order to follow the instructions described in this post, you will need to go through this post which describes which software components and packages are needed to setup a PXE infrastructure.  

Overview 

Deploying Ubuntu Desktop through PXE is not that straight forward as we thought. Googling around, we have found out that apparently a lot of people have tried to perform such operations but didn’t really succeeded.  There are even bug reports in the Launchpad (see for example here).Based on all the information we have gathered, we have been able to perform such operation.  So,let’s move to hands on activities…. 

Assumptions 

To have a working solution, we are assuming that 

  • a single computer hosting DHCP,TFTP,PXE and storage services is already present on your network 
  • the pxe computer has been configured based on the instructions found in our previous post
  • Ubuntu 18.04.x Desktop will be deployed through PXE. You have an Ubuntu 18.04.x valid iso file 
  • Only BIOS computer will be able to connect to the PXE server and start the installation (no UEFI yet !) 
  • You have internet connection in order to download necessary packages  

So, if you meet all these requirements, we can move to the next section…

Step by Step Guide 

Step 1 – Build up your PXE Infrastructure 

Again, as a reminder, before proceeding here, you will first need to follow the instructions found here in order to setup the appropriate PXE Infrastructure

Step 2 – Copy Ubuntu Desktop Install file to your local repository

Based on the setup explained in our previous post, we are ready to copy the necessary Ubuntu Desktop installation file in our PXE Repository infrastructure.  By default, we are using the /var/www/html location as our repository and where we place our installation files. 

It’s important to have a clean directory structure.  This is why we have created the following sub folders (screenshot)

uDesktp_PXE_01

Click on Picture for Better Resolution

 

The server folder will contain Ubuntu Servers installation files.  For each Ubuntu release, a dedicated subfolder will be created within this folder.  The desktop folder will contain Ubuntu desktop installation files.  For each Ubuntu release, a dedicated sub folder will be created within this folder. In the screenshot below, we have at the moment only one sub folder called bionic… You’ve got the idea….  

uDesktp_PXE_02

Click on Picture for Better Resolution

At this stage, you can mount the Ubuntu Desktop iso image into your computer. When the image is mounted, you can navigate to the location where the installation files are located and you can copy them in the correct folder under your /var/www/html/desktop/bionic  (in our example) 

uDesktp_PXE_06

Click on Picture for Better Resolution

 

Step 2 – Copy additional Boot files in TFTP Directory  

 

uDesktp_PXE_08

Click on Picture for Better Resolution

 

uDesktp_PXE_03

Click on Picture for Better Resolution

 

Step 3 – Install NFS packages

To be able to deploy Ubuntu desktop,  you will need to install the nfs-kernel package on top of what has been provided in the previous post. To install this package, you simply execute the following command in a terminal console 

sudo apt-get install nfs-kernel-server 

You might be prompt to confirm your choice.  Proceed and wait for the operation to complete 

uDesktp_PXE_09

Click on Picture for Better Resolution

Step 4 – Configure NFS packages

Now that we have a file service available through the NFS protocol, we need to ensure that the directory is made available through the network. To achieve that, we will need to edit the /etc/exports file.  

uDesktp_PXE_11

Click on Picture for Better Resolution

Insert at the bottom of the file, the path where you have stored your installation files, which subnet can access it and which kind of right you want to grant.  In the screenshot below and based on your scenario, we want to make the path /var/www/html/desktop/bionic available to the network subnet 192.168.1.0/24 and we want to grant read only access (ro)

uDesktp_PXE_10

Click on Picture for Better Resolution

When this has been done, it’s time to restart the nfs service. To do that, you simply execute the following command 

sudo systemctl restart nfs-kernel-server

uDesktp_PXE_12

Click on Picture for Better Resolution

 

Step 5 – Edit the pxe configuration files 

This is the final step of our configuration.  Now, we have to modified the pxe files in order to tell the system where to find the correct file when trying to boot Ubuntu Desktop from the network. We will need to modify a file called txt.cfg  located under /tftp/boot/ubuntu-installer/amd64/boot-screens

uDesktp_PXE_04

Click on Picture for Better Resolution

You will have to append the following text at the bottom of the file

label ubuntudesktop
  menu label Ubuntu Desktop 18.04 Live
  kernel casper/vmlinuz 
  append nfsroot = 192.168.1.150:/var/www/html/desktop/bionic netboot=nfs  ro file=/cdrom/preseed/ubuntu.seed boot=casper initrd=/casper/initrd.lz systemd.mask=tmp.mount --

uDesktp_PXE_05

Click on Picture for Better Resolution

Finding these commands was the most difficult part of this post.  We had to look in a lot of location and a lot of googling.  Actually, some of the commands can be found in the /boot/grub.cfg (if you are interested) 

Test your configuration 

It’s time to test this configuration.  So, we have used a virtual machine and configured to boot from the network card.  As you can see in the screenshot, the client is receiving an IP address leased by the DHCP Server and the PXE connection starts…. 

uDesktp_PXE_15

Click on Picture for Better Resolution

Again, you will see the familiar Ubuntu installation menu. However, because we have modified the txt.cfg file, we can see the additional option in the menu.  So select the option Ubuntu Desktop 18.04 Live option and wait for the system to boot into the live system

uDesktp_PXE_13

Click on Picture for Better Resolution

After some time and if everything goes fine, you should see the familiar desktop interface that is presented to you when starting the installation process.  

uDesktp_PXE_14

Click on Picture for Better Resolution

To proceed with the installation, simply click on the desktop icon Install and again the well known installation wizard will be displayed and you can proceed with your installation… 

Final Notes

This is it !  When you know exactly which commands you have to execute and where to place the files, performing a pxe installation for Ubuntu server or desktop is not that complicated. At this stage of our journey, we have only covered the foundations of pxe network installation.  If you need to mass deploy ubuntu operating system; you might want to automate the installation process as well so you can have something useful within your network.    We might cover these topics in some future posts…we do not know yet 

Hope you enjoyed this post 

Till next time 

See ya

 

 

 

Leave a Reply