Install Ubuntu Linux over the network with the help of a Mac
May 05, '10 07:30:00AM
Contributed by: elmimmo
This hint is about installing Ubuntu Linux over the Internet on a PC compatible with network boot (PXE) without using a CD/DVD drive, a USB Flash drive, or having previously downloaded a full disc image.
You will need another computer on the same LAN. I will be using a Mac, hence why you're reading this hint here. Both computers obviously need Internet access.
On the Mac:
- Install a DHCP server. The command below assumes you have Macports installed on your Mac, which allows for easy install of lots of Unix apps. In Terminal, run this command:
$ sudo port install dhcp
There are other ways to install a DHCP server, but I will not cover them. In fact, Mac OS X probably comes with one (for its Internet Sharing feature), but using Macports was easier to me than finding out where it is and how to use it.
- Create the folder /Users/Shared/tftpboot/
- Download TFTPServer and launch it. Click the toolbar button Change Path and set it to /Users/Shared/tftpboot/. Click the Fix button at the bottom to set folder permissions appropriately, and start the server with the Start TFTP toolbar button.
- Download Ubuntu Linux' netboot image. Login to the Ubuntu FTP server (user: anonymous).
As of today, Lucid Lynx (download via FTP) is the latest release. Download all files on that ftp folder to /Users/Shared/tftpboot/, or use the first link above to pick another distribution.
- Open up your favorite plain text editor, and copy and paste the following lines:
authoritative;
ddns-update-style none;
pid-file-name "/Users/Shared/tftpboot/dhcpd.pid";
# Change X.X.X to your LAN's IP range (something like 10.0.0, 192.168.1, 192.168.0…)
subnet X.X.X.0 netmask 255.255.255.0 {
range X.X.X.151 X.X.X.205;
}
option domain-name-servers 8.8.8.8;
host netbook {
# Change X.X.X to your LAN's IP range (something like 10.0.0 or 192.168.1)
# Change ??:??:??:??:??:?? to the MAC address of the computer you
# want to install Linux on.
hardware ethernet ??:??:??:??:??:?? ;
filename "pxelinux.0";
next-server X.X.X.101;
fixed-address X.X.X.202;
option subnet-mask 255.255.255.0;
option broadcast-address X.X.X.255;
# Change the 'n' in the next line to the number in the last
# segment of your Internet router's local IP address.
option routers X.X.X.n;
}
Edit according to the comments preceded by #, and save it as dhcp.conf in the folder /Users/Shared/tftpboot/.
If you do not know the MAC address of the computer you want to install Linux on, go to the next section ('On your network boot-compatible (PXE) PC'), do steps one and two, and give it some time. The MAC address will probably appear on screen at some point.
- Run the DCHP server by executing this command in Terminal:
$ sudo dhcpd -f -d -cf /Users/Shared/tftpboot/dhcp.conf > /Users/Shared/tftpboot/dhcpd.log
On your network boot-compatible (PXE) PC:
- Plug it to your local network with an ethernet cable.
- Turn it on, and look for a way to change boot order of devices. You may have to press an F key, or change a setting in its BIOS. The former is preferable. Select Network boot or something that sounds like that.
Note: it is usually not advisable to run more than one DHCP server on the same IP range. Your internet home router may be running one as well so that all your devices can access the internet without having to manually tweak their network configuration. Nevertheless, I did not switch my router's DHCP server off and everything still worked fine. Your mileage may vary.
- Follow on-screen install instructions.
Once the installation has finished, you can safely stop the DCHP server in your Mac pressing keys Command and period (in Terminal), quit the TFTPServer app, drag that application and the folder /Users/Shared/tftpboot/ to the Trash, and uninstall the DCHP server with the command below (if you installed it using Macports):
$ sudo port uninstall dhcp
[crarko adds: I haven't tested this one.]
Comments (22)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20100501044411838