How to NetBoot and NetInstall Ubuntu
Monday, May 3, 2010 12:43:58 AM
Normally when you want to install a new operating system on a computer, you either burn a CD or use a USB key with the installer for that operating system and make the computer boot from that media.
There's another device you can boot your computer from: the network card. This has some advantages:
a) It's the only way if you have a broken CD-ROM drive and your computer can't boot from a USB key.
b) You don't have to use additional media.
This method works with other linux based OSs like Debian (I originally used this method for Debian) or Fedora (I didn't test it but I know they provide the netboot.tar.gz package) and with some modification it will probably work on BSD-like systems. But in the case of Ubuntu, it provides the additional advantages:
c) It's the only way I know that allows you to install from the Internet, installing from the Internet ensures that the installed packages are up to date. So don't bother running the Update Manager when you finished installing.
d) It allows you chose the Desktop Environment (or non at all) at installation time (I actually use this to install a basic command line system and then install Lubuntu).
OK, first lets see if you have the basic requirements to perform a Net boot/install:
1. A computer running a unix-like system (in this how-to it's Ubuntu), which I'll call server.
2. A target computer (where you will install the new system) that is capable of from the network card (if your computer can't, scroll down to Appendix A, there might be a solution).
3. A home network with access to the Internet, you usually have one if you connect to the Internet through a Home Gateway (Router), but not if you use a modem (like Broad Band connections or older ADSL modems).
Let's get started. On our server, we need to install a couple of things: a DHCP server (which tells the target system what to do) and a TFTP server (which provides the bootable stuff to the target).
1. In a command shell enter: sudo apt-get install dhcp3-server tftpd-hpa
Now we need to configure the DHCP server:
2. sudo gedit /etc/dhcp3/dhcpd.conf
Go to the end the of file you just opened in gedit and insert something like this:
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.150 192.168.10.200;
option routers 192.168.10.1;
option domain-name-servers 192.168.10.1;
filename "pxelinux.0";
next-server 192.168.10.5;
}
You have to adapt this to your home network. To get the information you need, you can use the command "ifconfig", or simply right click the network manager applet and click Connection Information:

In the first line you enter the subnet and it's respective mask, for Home Gateways it's typically: 192.168.X.0 255.255.255.0 where X may vary but always matches IP address of your computer. You have to adapt this X value to the range addresses as well.
The options "routers" and "domain-name-servers" usually have the address of your Home Gateway, they match the "Default Route" and "Primary DNS" fields you can extract from the Connection Information dialog.
The "filename" field states the filename that should be requested to the TFTP server, you can let it be "pxelinux.0" for probably all linux based OSs. And the "next-server" declares the address of the machine that will provide the file, in the case the server we are working on, so it's equivalent to the "IP Address" field in the "Connection Information" window.
The hardest part has been done (I hate editing text files to tell a machine what to do). Now we need the bootable files:
3. Get the netboot.tar.gz package for the system you want. For Ubuntu, go to http://cdimage.ubuntu.com/netboot/
, choose the distribution and and architecture (in doubt it's i386) and then download the netboot.tar.gz file.
We can use the default configuration of the tftpd-hpa package we installed earlier, we just need to the files where it is expecting them to be so back to the command line:
4. sudo cp ./Downloads/netboot.tar.gz /var/lib/tftpboot/
5. cd /var/lib/tftpboot/
6. sudo tar xfz netnoot.tar.gz
Next we start start our boot services:
7. sudo /etc/init.d/tftpd-hpa start
8. sudo /etc/init.d/dhcp3-server start
If step 8 fails, go back to step 2 and check if the syntax of your entry is correct (semi-colons, brackets and stuff).
9. Boot the target computer(s) and have them boot from the network card.
Note: Home Gateways have a built-in DHCP server. If your target PC is using the reply from the Home Gateway instead of the one provided from the server you just set up, you might need to temporarily disable the DHCP server in the router. Consult the router's manual or contact your ISP for help doing this.
If everything went well, you now have an installation kernel running on your target machine and you only have to follow the instructions. At this point you can stop the server:
7. sudo /etc/init.d/tftpd-hpa stop
8. sudo /etc/init.d/dhcp3-server stop
I'm using "Ubuntu - Lucid Lynx" right now so I have:
Install
Command-line install
Advanced options
Help
If you want to install an official pack go with Install. After installing the base system, you will be prompted to install additional software packs. Choose ubuntu-desktop for the standard Gnome system or any of the other variants: kubuntu-desktop, xubuntu-desktop, mythubuntu, etc.
If you want some non official or customized spin (like Lubuntu) go with Command-line install. You can then build your desktop from the ground up.
If you want to install Lubuntu, just login and then:
sudo add-apt-repository ppa:lubuntu-desktop/ppa
sudo apt-get update
sudo apt-get install lubuntu-desktop
sudo reboot
have fun
------------------------------------------
Appendix A:
If your target computer cannot NetBoot, you can still use this method thanks to a great project named gPXE.
Got to http://rom-o-matic.net/ and choose an Image Generator (the latest production release is fine).
Choose an appropriate output format:
ISO bootable image (to write to CD)
USB key (to boot from USB)
If your machine can only boot from the hard drive, but you have a working unix-like system with LILO or GRUB installed, you can ask for a
Linux kernel (SYSLINUX/GRUB/LILO) loadable image (.lkrn)
and then add an entry to GRUB or LILO to boot from it. I will not show how to do that here, sorry.
There's another device you can boot your computer from: the network card. This has some advantages:
a) It's the only way if you have a broken CD-ROM drive and your computer can't boot from a USB key.
b) You don't have to use additional media.
This method works with other linux based OSs like Debian (I originally used this method for Debian) or Fedora (I didn't test it but I know they provide the netboot.tar.gz package) and with some modification it will probably work on BSD-like systems. But in the case of Ubuntu, it provides the additional advantages:
c) It's the only way I know that allows you to install from the Internet, installing from the Internet ensures that the installed packages are up to date. So don't bother running the Update Manager when you finished installing.
d) It allows you chose the Desktop Environment (or non at all) at installation time (I actually use this to install a basic command line system and then install Lubuntu).
OK, first lets see if you have the basic requirements to perform a Net boot/install:
1. A computer running a unix-like system (in this how-to it's Ubuntu), which I'll call server.
2. A target computer (where you will install the new system) that is capable of from the network card (if your computer can't, scroll down to Appendix A, there might be a solution).
3. A home network with access to the Internet, you usually have one if you connect to the Internet through a Home Gateway (Router), but not if you use a modem (like Broad Band connections or older ADSL modems).
Let's get started. On our server, we need to install a couple of things: a DHCP server (which tells the target system what to do) and a TFTP server (which provides the bootable stuff to the target).
1. In a command shell enter: sudo apt-get install dhcp3-server tftpd-hpa
Now we need to configure the DHCP server:
2. sudo gedit /etc/dhcp3/dhcpd.conf
Go to the end the of file you just opened in gedit and insert something like this:
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.150 192.168.10.200;
option routers 192.168.10.1;
option domain-name-servers 192.168.10.1;
filename "pxelinux.0";
next-server 192.168.10.5;
}
You have to adapt this to your home network. To get the information you need, you can use the command "ifconfig", or simply right click the network manager applet and click Connection Information:

In the first line you enter the subnet and it's respective mask, for Home Gateways it's typically: 192.168.X.0 255.255.255.0 where X may vary but always matches IP address of your computer. You have to adapt this X value to the range addresses as well.
The options "routers" and "domain-name-servers" usually have the address of your Home Gateway, they match the "Default Route" and "Primary DNS" fields you can extract from the Connection Information dialog.
The "filename" field states the filename that should be requested to the TFTP server, you can let it be "pxelinux.0" for probably all linux based OSs. And the "next-server" declares the address of the machine that will provide the file, in the case the server we are working on, so it's equivalent to the "IP Address" field in the "Connection Information" window.
The hardest part has been done (I hate editing text files to tell a machine what to do). Now we need the bootable files:
3. Get the netboot.tar.gz package for the system you want. For Ubuntu, go to http://cdimage.ubuntu.com/netboot/
, choose the distribution and and architecture (in doubt it's i386) and then download the netboot.tar.gz file.
We can use the default configuration of the tftpd-hpa package we installed earlier, we just need to the files where it is expecting them to be so back to the command line:
4. sudo cp ./Downloads/netboot.tar.gz /var/lib/tftpboot/
5. cd /var/lib/tftpboot/
6. sudo tar xfz netnoot.tar.gz
Next we start start our boot services:
7. sudo /etc/init.d/tftpd-hpa start
8. sudo /etc/init.d/dhcp3-server start
If step 8 fails, go back to step 2 and check if the syntax of your entry is correct (semi-colons, brackets and stuff).
9. Boot the target computer(s) and have them boot from the network card.
Note: Home Gateways have a built-in DHCP server. If your target PC is using the reply from the Home Gateway instead of the one provided from the server you just set up, you might need to temporarily disable the DHCP server in the router. Consult the router's manual or contact your ISP for help doing this.
If everything went well, you now have an installation kernel running on your target machine and you only have to follow the instructions. At this point you can stop the server:
7. sudo /etc/init.d/tftpd-hpa stop
8. sudo /etc/init.d/dhcp3-server stop
I'm using "Ubuntu - Lucid Lynx" right now so I have:
Install
Command-line install
Advanced options
Help
If you want to install an official pack go with Install. After installing the base system, you will be prompted to install additional software packs. Choose ubuntu-desktop for the standard Gnome system or any of the other variants: kubuntu-desktop, xubuntu-desktop, mythubuntu, etc.
If you want some non official or customized spin (like Lubuntu) go with Command-line install. You can then build your desktop from the ground up.
If you want to install Lubuntu, just login and then:
sudo add-apt-repository ppa:lubuntu-desktop/ppa
sudo apt-get update
sudo apt-get install lubuntu-desktop
sudo reboot
have fun
------------------------------------------
Appendix A:
If your target computer cannot NetBoot, you can still use this method thanks to a great project named gPXE.
Got to http://rom-o-matic.net/ and choose an Image Generator (the latest production release is fine).
Choose an appropriate output format:
ISO bootable image (to write to CD)
USB key (to boot from USB)
If your machine can only boot from the hard drive, but you have a working unix-like system with LILO or GRUB installed, you can ask for a
Linux kernel (SYSLINUX/GRUB/LILO) loadable image (.lkrn)
and then add an entry to GRUB or LILO to boot from it. I will not show how to do that here, sorry.







