Install Ubuntu via iPXE for UEFI:
Prerequisites:
• iPXE
• TFTP
• NFS
• DHCP Server
First of all, let us download the needed ISO files for this project.
Ubuntu Desktop 22.04.2 LTS
Ubuntu 22.10 live server
iPXE:
iPXE can serve as a network boot server for both BIOS and UEFI systems. It’s open source, it can use many protocols to download the required boot files (TFTP, FTP, HTTP, HTTPS and NFS), but it needs compiling. In this case we will use a live installer on our synology virtual machine to compile iPXE and transfer it to our NAS.
Creating a iPXE shared folder:
Let’s create a shared folder to keep our iPXE boot files organized.
On your Synology, go to Control Panel and select Shared Folder.
Click Create and click Create Shared Folder.
Fill out the name for the folder and click Next.
In this case, encryption is not needed, click Next again.
On the next screen, click Next.
This is what your settings should look like. Click Next again.
In the following screen, leave the settings as is, (administrator and your own account should have read/write access). And click Apply.
Enable TFTP:
In Control Panel, go to File Services.
Go to tab Advanced, Enable TFTP Service and Click Select.
Select the Shared Folder you just created. Click Select and Apply.
Next, we are going to enable NFS. Go to tab NFS and select Enable NFS and Apply.
Go back to Shared Folder in Control Panel, select your shared folder for iPXE and click Edit.
Go to tab NFS Permissions and click Create.
In the Hostname or IP field, put an asterisk (*)
Privilege should be Read only
Select Allow connections from non-privileged ports and select Allow users to access mounted subfolders. Click Save.
You should see something like this. Click Save again to apply the permissions on your shared folder.
Copy your Ubuntu Desktop and Ubuntu Server ISO files to the iPXE shared folder.
Creating a ubuntu virtual machine on your nas to boot in live mode:
Go to Package Center and look for Virtual Machine Manager.
If not installed, install Virtual Machine Manager.
When Virtual Machine Manager is installed, open it.
On the left side, go to Virtual Machine and on top of the window, click on Create.
Select Linux and click Next.
Select your storage and click Next.
Give your virtual machine a name, assign a CPU and Memory. Click Next.
Assign 30GB of diskspace and click Next.
For network, select Virtual network and click Next.
On the next screen for ISO file for bootup, click Browse and select ubuntu-22.04.2-desktop-amd64.iso and click Select.
Leave the rest of the settings and click Next.
For the power management permissions. Give your own user Allow rights and click Next.
Everything should look like this. Click Done.
The virtual machine will be created and will automatically boot.
Select the virtual machine and click Connect. A new browser window will open and your virtual machine will show.
Installing required Dependencies for building iPXE on Ubuntu Desktop Live:
Open the terminal.
$ sudo apt-add-repository universe
Press Enter.
$ sudo apt install build-essential liblzma-dev isolinux git
Press Y to continue.
Cloning iPXE Git Repository:
First navigate to ~/Downloads
$ git clone https://github.com/ipxe/ipxe.git
Check if the Git Repository was downloaded.
$ ls -l
Navigate to ipxe/src/
$ cd ipxe/src/
List the directory again.
$ ls -l
Enabling iPXE NFS, HTTPS, and FTP Protocol Support:
$ nano config/general.h
Scroll to * Download protocols
Change #undef to #define for DOWNLOAD_PROTO_HTTPS, DOWNLOAD_PROTO_FTP and DOWNLOAD_PROTO_NFS.
Press CTRL – X, Y and enter.
Creating an iPXE embedded Boot Configuration File:
$ nano bootconfig.ipxe
192.168.0.185 is the IP-address of my server, change it to the IP-address of your own server.
Press CTRL – X, Y and enter.
Compiling iPXE for UEFI-Based Motherboards:
$ make bin-x86_64-efi/ipxe.efi EMBED=bootconfig.ipxe
The ipxe.efi firmware is being compiled. This could take a minute or two to complete.
Uploading the required file to the NAS:
$ cp bin-x86_64-efi/ipxe.pxe ~/Downloads/
Open Firefox, go to the webinterface op your NAS and open File Station.
open Files in Ubuntu, navigate to the Downloads folder and drag ipxe.efi into File Station in Firefox.
Shut down the virtual machine and go back to the usual web-interface in your browser.
Put ipxe.efi in the iPXE folder we created.
Create a new folder by clicking on Create. Name the folder config (!!!all small letters!!!) and click OK.
If not installed yet, in Package Center, install Tekst Editor.
Once installed, open Text Editor.
Click File – New.
Edit the file as shown below and save it in iPXE/Config as boot.ipxe
Enable DHCP and PXE on Synology NAS:
Select your LAN-device, click Enable DHCP server.
Next, click Edit.
Fill out the Primary and Secondary DNS. Click on Create.
Fill start and end IP address and as gateway, Netmask is 255.255.255.0 take the IP-address of your router. Address lease time is 3600 seconds. Click Create and click OK.
Now activate the subnet.
On tab PXE, Enable PXE and click Select.
Choose ipxe.efi and click select. Next click Apply.
Mounting the ISO files on your NAS:
Go to File Station and navigate tot he iPXE folder we created.
Right click on the ubuntu desktop and ubuntu server ISO files we copied and click Mount Virtual Drive.
Make sure to select Mount automatically on startup and click on Mount.
Now our iPXE folder should look like this:
Open Text Editor and edit boot.ipxe.
Our file should look like this:
Then, we modify it like this:
Set server_ip: IP-address of your NAS.
Set base: IP-address/volume pool/iPXE 192.168.0.185/volume1/iPXE
Make sure set os_name is equal to the folder name in iPXE. We use this to define the nfs-path to download the files we need to install the Operating Systems.
Example nfsroot: nfsroot=192.168.0.1:/volume1/iPXE/ubuntu-22.10-live-server-amd64