In this tutorial, I’ll guide you through how to to setup OSX as PXE server to install Ubuntu on other hosts.
Introduction
The Preboot Execution Environment (PXE) is widely used in enterprise environment for mass deployment, however it is not well-known in home and office environment because it is always easier to install Ubuntu Linux using traditional CD/DVD or USB storage devices method.
If your box doesn’t have CD/DVD or USB storage devices, you can install Ubuntu using PXE. The concept is very simple, a computer that host TFTP server and the to-be-installed host support PXE.
I adapt the concept to OSX to show you that you could achieve the same result with Mac OSX. In this tutorial, I use OSX 10.8.2. However, it should also work with older versions.
We only need the netboot installer of Ubuntu, you don’t have to download a full ISO for the purpose. The file that we need to download is the netboot.tar.gz which can be found at http://cdimage.ubuntu.com/netboot/.
Open your Terminal.app
Use curl command to download the netboot installer:
12
$ cd /tmp
$ curl -O http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-i386/current/images/netboot/netboot.tar.gz
Extract netboot.tar.gz to suitable folder that we are going to use as TFTP root folder
12
$ mkdir ~/Downloads/tftp
$ tar -xvzf netboot.tar.gz -C ~/Downloads/tftp
Fix folder permissions:
1
$ sudo chown -R nobody:nogroup ~/Downloads/tftp
Set up TFTP server
Easy setup with TFTP Server software
Though OSX comes with tftp command line, it still takes more steps to setup manually. Alternatively, you can download the TFTP Server. It provides a GUI to configure the built-in tftp server on OSX.
Open the DMG file and drag the application into your Applications folder.
Open the TftpServer.app.
We will NOT use the default /private/tftpboot as root for TFTP server. From TftpServer.app’s screen, click on Change Path icon and select Downloads/tftp and you should see the path bar change to /Users/yourusername/Downloads/tftp.
Fixing folder permission by click on Fix buttons of both Working path permission and Parentals folders permissions. You should see Attributes OK if all goes well.
Start the server by clicking on Start TFTP. You should see Server Status change to Running.
Hard setup using built-in tftp server
For whom who want to set up the tftp manually via CLI.
Configure the server by modify the tftp.plist into a suitable folder for modification:
In concept, PXE-bootable device will look for DHCP service in order to receive available PXE boot server. If you don’t have a DHCP servive running locally in router or in your LAN, you have to set up a DHCP server.
With isc-dchpd
Install isc-dhcpd with Homebrew:
1
$ brew install isc-dhcp
Create configuration file at /usr/local/etc/dhcpd.conf:
123456789101112131415161718
default-lease-time 600;
max-lease-time 7200;
subnet X.X.X.0 netmask Y.Y.Y.0 {
range X.X.X.151 X.X.X.205;
}
option domain-name-servers 8.8.8.8;
host netbook {
hardware ethernet ??:??:??:??:??:??;
filename "pxelinux.0";
next-server Z.Z.Z.Z; # the IP address of your TFTP server
fixed-address X.X.X.202;
option subnet-mask Y.Y.Y.0;
option broadcast-address X.X.X.255;
option routers X.X.X.1;
}
in which X.X.X is your network address, Y.Y.Y is your subnet mask, ??:??:??:??:??:?? is the MAC address of the box you want to install to and finally Z.Z.Z.Z is the address of TFTP server.
OSX does come with a built-in BOOTP server called bootpd, which offer also offer DHCP service. This technology is known as NetBoot and used to install OSX on CD/DVD-less machines like MacBook Air or Mac Mini. I adapt instructions at Jacques Fortier’s blog for this tutorial.