Difference between revisions of "Ubuntu PXE Install"

From C4 Wiki
Jump to: navigation, search
(Prepare your dhcp-server)
(Links)
 
(82 intermediate revisions by 51 users not shown)
Line 1: Line 1:
 
=Howto=
 
=Howto=
Installing Ubuntu via PXE network boot is the way to go if you have no cd-r at hand or if you have no cdrom at all.
+
Installing Ubuntu or Debian via PXE network boot is the way to go if you have no cd-r at hand, or if you have no cdrom drive on the machine to be installed.
 
 
After reading [http://www.debianplanet.com/node.php?id=818&cid=13384 Installation of Woody with PXE] it wasn't hard to setup a PXE boot environment.
 
  
 
==Install services==
 
==Install services==
You need the following debian packages:
+
You need the following packages:
 
* tftpd-hpa  
 
* tftpd-hpa  
 
* dhcp3-server
 
* dhcp3-server
 +
* netkit-inetd
 +
sudo apt-get install tftpd-hpa dhcp3-server openbsd-inetd
 +
 +
Note: On Gutsy (7.10) and Debian Etch netkit-inetd is a "virtual package". Either inetutils-inetd or openbsd-inetd must be chosen. On one system, openbsd-inetd is already installed - the default now?
  
 
==Prepare your tftp server==
 
==Prepare your tftp server==
Start your tftpd server via inetd with the following line in /etc/inetd.conf:
+
Start your tftpd server via inetd after adding the following line in /etc/inetd.conf:
 
  tftp          dgram  udp    wait    root  /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot
 
  tftp          dgram  udp    wait    root  /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot
 +
 +
sudo update-inetd --enable BOOT
  
 
Don't forget to create the tftp directory /var/lib/tftpboot (if it hasn't already been created)
 
Don't forget to create the tftp directory /var/lib/tftpboot (if it hasn't already been created)
  
On Ubuntu 6.06 Server (or if /etc/inetd.conf doesn't exist) you might edit /etc/default/tftpd-hpa:
+
On Ubuntu 6.06 Server and Feisty Fawn 7.04 (or if /etc/inetd.conf doesn't exist) you might edit /etc/default/tftpd-hpa:
 
  RUN_DAEMON="yes"
 
  RUN_DAEMON="yes"
 
  OPTIONS="-l -s /var/lib/tftpboot"
 
  OPTIONS="-l -s /var/lib/tftpboot"
 +
 +
and start the daemon via the command
 +
  sudo /etc/init.d/tftpd-hpa start
 +
 +
Verify that inetd is listening on the right port:
 +
netstat -lu
 +
should show
 +
udp        0      0 *:tftp                  *:*     
 +
(On one Gutsy system, inetutils-inetd insisted on listening on an ipv6 socket,
 +
and booting via tftp failed.  Switching to openbsd-inetd solved the problem.)
  
 
==Prepare your dhcp-server==
 
==Prepare your dhcp-server==
If you have a working dhcp server add the following lines to your group, substituting ip and mac address as needed
+
On what network interfaces should the DHCP server (dhcpd) serve DHCP requests?
 +
Answer this question by editing the line in /etc/default/dhcp3-server file.
 +
Separate multiple interfaces with spaces, e.g. "eth0 eth1". Eg:
 +
 
 +
INTERFACES="eth1 eth2"
 +
 
 +
If you have a working dhcp server add the following lines to your group in /etc/dhcpd.conf file (or, from Etch and Feisty upward, the /etc/dhcp3/dhcpd.conf file), substituting IP and MAC address as needed. Beware not to forget the semicolons (";") at the end of lines.
 
  host pxeinstall {
 
  host pxeinstall {
   hardware ethernet [mac-address of pxe networkcard without brackets];
+
   # ie. "hardware ethernet 00:0A:E4:2E:A6:42;"
 +
  hardware ethernet ''[MAC address of PXE client networkcard, without brackets]'';
 +
 +
  # this is the unused IP address we will assign temporarily to the PXE client
 
   fixed-address 10.0.0.16;
 
   fixed-address 10.0.0.16;
   next-server [ip-address of the server serving tftp];
+
 +
  # Not needed if the tftp server is on the same host as the DHCP server. ie. "next-server 10.0.0.2;".
 +
  # edit : Well needed, otherwise he is looking for the host 0.0.0.0 so, it doesn't work
 +
   next-server [ip-address of the server serving tftp];  
 +
 +
  # path of the bootloader file, relative to tftpd's root
 
   filename "pxelinux.0";
 
   filename "pxelinux.0";
 
  }
 
  }
  
The following simpler file may also work in a trivial environment
+
The "next-server" stanza tells the PXE boot client where to look for the boot image and associated data. It is required in newer editions of tftpd-hpa, if not on the same machine as the DHCP server.
  subnet 0.0.0.0 netmask 0.0.0.0 {
+
 
   range 192.168.0.1 192.168.0.2;
+
Instead, if you do not need MAC-based configuration (e.g. you want to be able to boot any host), you can just add a filename stanza to a subnet configuration (verified on Intrepid):
 +
 
 +
  subnet 192.168.0.0 netmask 255.255.255.0 {
 +
   range 192.168.0.100 192.168.0.254;
 +
  option routers 192.168.0.1;
 +
 
 +
  #substitute the DNS addresses of your own Internet Service Provider (ISP)
 +
  option domain-name-servers ''primary.dns.from.isp'', ''secondary.dns.from.isp'';
 +
 
 
   filename "pxelinux.0";
 
   filename "pxelinux.0";
 
  }
 
  }
  
(the one below worked for me, while the one above did not)
+
You need to assign the client an IP address in the same subnet as the address of the server running tftpd.  For example, if your server's address is 192.168.'''2'''.13, you should assign your client an IP address that begins with 192.168.'''2'''.x, NOT 192.168.'''0'''.x . If your client doesn't recieve an IP-address, you might want to add '''authoritative;''' above the subnet declaration.
  
The next-server stanza tells the pxe boot client where to look for the boot image and associated data. It is required in newer editions of tftpd-hpa. (I spent a couple of ours trying to figure out why the destination address of the tftp UDP datagrams was 0.0.0.0).
+
When you are done configuring your dhcp server, (re)start it:
 +
/etc/init.d/dhcp3-server restart
  
'''Update (AUgust 20, 2006):''' for an installation from an Ubuntu server to a Toshiba Portege 3480CT it was MANDATORY to indicate in the DHCP server configuration file the MAC address of the Toshiba laptop. As soon as the DHCP server was restarted the PXE bott process started. So in my case the first lines worked.
+
And verify it runs (if not, you may have a problem in the dhcpd config file):
 +
ps ax | grep dhcpd
  
==Prepare ubuntu netboot==
+
==Prepare netboot files==
===Get the files===
+
===Get and install the files===
All the files you need are on the install media, or you can get them [http://archive.ubuntu.com/ubuntu/dists/warty/main/installer-i386/current/images/netboot/ here]
+
All the files you need are on the install media, or you can get them from internet:
 +
* For Ubuntu [http://archive.ubuntu.com/ubuntu/dists/dapper/main/installer-i386/current/images/netboot/ Dapper 6.06], [http://archive.ubuntu.com/ubuntu/dists/edgy/main/installer-i386/current/images/netboot/ Edgy 6.10], [http://archive.ubuntu.com/ubuntu/dists/feisty/main/installer-i386/current/images/netboot/ Feisty 7.04], [http://archive.ubuntu.com/ubuntu/dists/gutsy/main/installer-i386/current/images/netboot/ Gutsy 7.10], [http://archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current/images/netboot/ Hardy 8.04], [http://archive.ubuntu.com/ubuntu/dists/intrepid/main/installer-i386/current/images/netboot/ Intrepid 8.10], [http://archive.ubuntu.com/ubuntu/dists/jaunty/main/installer-i386/current/images/netboot/ Jaunty 9.04], [http://archive.ubuntu.com/ubuntu/dists/lucid/main/installer-i386/current/images/netboot/ Lucid 10.04], [http://archive.ubuntu.com/ubuntu/dists/maverick/main/installer-i386/current/images/netboot/ Maverick 10.10]. All 32 bit (i386) files, for 64 bit files, replace installer-i386 with installer-amd64 in URLs.
 +
* For Debian : [http://http.us.debian.org/debian/dists/sarge/main/installer-i386/current/images/netboot/ Sarge 3.1], [http://http.us.debian.org/debian/dists/etch/main/installer-i386/current/images/netboot/ Etch 4.0], [http://http.us.debian.org/debian/dists/lenny/main/installer-i386/current/images/netboot/ Lenny 5.0].
  
Put the netboot files into the /tftpboot directory.
+
Download and put the netboot directory content at the root of the tftpd's served /var/lib/tftpboot/ directory:
lftp -c "open http://archive.ubuntu.com/ubuntu/dists/dapper/main/installer-i386/current/images/; mirror netboot/"
 
cp -a netboot/* /var/lib/tftpboot
 
# untar the pxeboot.tar.gz
 
 
  cd /var/lib/tftpboot/
 
  cd /var/lib/tftpboot/
 +
lftp -c "open http://archive.ubuntu.com/ubuntu/dists/lucid/main/installer-i386/current/images/netboot/; mirror"
 +
 +
# then untar the pxeboot.tar.gz (this step is NOT needed anymore, as of Feisty)
 
  tar xfz pxeboot.tar.gz
 
  tar xfz pxeboot.tar.gz
 +
 +
Alternatively, if Ubuntu is in your cdrom drive:
 +
mount /media/cdrom
 +
cp -a /media/cdrom/install/netboot/* /var/lib/tftpboot/
  
 
===pxe bootloader config===
 
===pxe bootloader config===
Edit or patch pxelinux.cfg/default .
+
 
 +
In the pxelinux.cfg/ directory, make a symlink named after the pxe boot client's mac address (without the colons), and pointing to the "default" config file:
 +
# ie. if our client mac address is 00:0A:E4:2E:A6:42, we'll do:
 +
ln -s /var/lib/tftpboot/pxelinux.cfg/default /var/lib/tftpboot/pxelinux.cfg/000AE42EA642
 +
 
 +
For very old distros versions, you may need to edit or patch pxelinux.cfg/default .  
 +
This modification is NOT needed anymore (at least from Feisty or Etch and up).
 +
 
 
<pre>
 
<pre>
 
--- default.org 2004-10-31 15:32:32.000000000 +0100
 
--- default.org 2004-10-31 15:32:32.000000000 +0100
Line 79: Line 130:
 
  timeout 0
 
  timeout 0
 
</pre>
 
</pre>
 
Make a symlink from default to the ip of the pxe boot client.
 
cd /tftpboot/pxelinux.cfg
 
ln -s default 0A000010
 
  
 
===Directory layout===
 
===Directory layout===
Should look like this:
+
Should look like this, more or less (depending on the Ubuntu or Debian installer version used):
 
<pre>
 
<pre>
/tftpboot/
+
/var/lib/tftpboot/
/tftpboot/pxelinux.0
+
/var/lib/tftpboot/pxelinux.0
/tftpboot/initrd.gz
+
/var/lib/tftpboot/initrd.gz
/tftpboot/mini.iso
+
/var/lib/tftpboot/mini.iso
/tftpboot/debian-installer
+
/var/lib/tftpboot/debian-installer
/tftpboot/debian-installer/linux
+
/var/lib/tftpboot/debian-installer/linux
/tftpboot/debian-installer/initrd.gz
+
/var/lib/tftpboot/debian-installer/initrd.gz
/tftpboot/debian-installer/boot-screens
+
/var/lib/tftpboot/debian-installer/boot-screens
/tftpboot/debian-installer/boot-screens/splash.rle
+
/var/lib/tftpboot/debian-installer/boot-screens/splash.rle
/tftpboot/debian-installer/boot-screens/f1.txt
+
/var/lib/tftpboot/debian-installer/boot-screens/f1.txt
/tftpboot/debian-installer/boot-screens/f2.txt
+
/var/lib/tftpboot/debian-installer/boot-screens/f2.txt
/tftpboot/debian-installer/boot-screens/f3.txt
+
/var/lib/tftpboot/debian-installer/boot-screens/f3.txt
/tftpboot/debian-installer/boot-screens/f4.txt
+
/var/lib/tftpboot/debian-installer/boot-screens/f4.txt
/tftpboot/debian-installer/boot-screens/f5.txt
+
/var/lib/tftpboot/debian-installer/boot-screens/f5.txt
/tftpboot/debian-installer/boot-screens/f6.txt
+
/var/lib/tftpboot/debian-installer/boot-screens/f6.txt
/tftpboot/debian-installer/boot-screens/f7.txt
+
/var/lib/tftpboot/debian-installer/boot-screens/f7.txt
/tftpboot/debian-installer/boot-screens/f8.txt
+
/var/lib/tftpboot/debian-installer/boot-screens/f8.txt
/tftpboot/debian-installer/boot-screens/f9.txt
+
/var/lib/tftpboot/debian-installer/boot-screens/f9.txt
/tftpboot/debian-installer/boot-screens/syslinux.txt
+
/var/lib/tftpboot/debian-installer/boot-screens/syslinux.txt
/tftpboot/debian-installer/boot-screens/f10.txt
+
/var/lib/tftpboot/debian-installer/boot-screens/f10.txt
/tftpboot/initrd.list
+
/var/lib/tftpboot/initrd.list
/tftpboot/vmlinuz
+
/var/lib/tftpboot/vmlinuz
/tftpboot/pxelinux.cfg
+
/var/lib/tftpboot/pxelinux.cfg
/tftpboot/pxelinux.cfg/default
+
/var/lib/tftpboot/pxelinux.cfg/default
/tftpboot/pxelinux.cfg/0A000010
+
/var/lib/tftpboot/pxelinux.cfg/000AE42EA642
 
</pre>
 
</pre>
 +
 +
In more detail we need to provide:
 +
* a bootloader, which name (or path relative to tftpd's served directory, here /var/lib/tftpboot) is mentioned in the dhcpd.conf file (pxelinux.0)
 +
* a configuration file for the bootloader (default for all clients, or mac specific)
 +
* a kernel with an initrd file (vmlinuz,initrd.gz)
 +
* an image of the base system (mini.iso)
  
 
==Start the PXE client==
 
==Start the PXE client==
Just boot up the computer that will use DHCP and then PXE to get the images, if something isn't working you can use a sniffer on your install server to check.
+
Just boot up the computer that will use DHCP and then PXE to get the images, if something isn't working you can use a sniffer on your install server to check, and look at log files for daemons misconfigurations.
  tethereal -R bootp
+
  tshark -R bootp
  #tethereal -VR bootp
+
  tshark port tftp
tethereal port tftp
+
  sudo tcpdump -s 1600 -neeevvvX 'proto (\udp or \tcp) and port (67 or 68 or 69)'
  tcpdump -n
+
tail /var/log/daemon.log
  
==Setup a mirror==
+
If your network card doesn't have a PXE stack, you can try downloading a stub client from http://rom-o-matic.net/
If you wish to run your network installs over a private network and use your own Ubuntu mirror you can do the following:
 
  
* Download apt-mirror and write a configuration file eg.:
+
==Optional: setup an archive mirror==
 +
With the previous setup, Ubuntu or Debian will download install packages straight over the internet.
 +
If you prefer to run your network installs over a private network and use your own Ubuntu or Debian mirror you can do the following:
  
 +
sudo apt-get install apt-mirror
 +
 +
Then write an /etc/apt/mirror.list configuration file, eg.:
 +
 +
Example for Ubuntu dapper:
 
<pre>
 
<pre>
set base_path      /usr/local/ubuntu/mirror
+
set base_path      /var/spool/apt-mirror/
 
deb http://gb.archive.ubuntu.com/ubuntu/ dapper main restricted
 
deb http://gb.archive.ubuntu.com/ubuntu/ dapper main restricted
 
deb http://gb.archive.ubuntu.com/ubuntu/ dapper main/debian-installer
 
deb http://gb.archive.ubuntu.com/ubuntu/ dapper main/debian-installer
Line 133: Line 192:
 
</pre>
 
</pre>
  
* Create a 'var' and 'skel' directory under your chosen base path
+
Example for Debian Etch:
 +
<pre>
 +
set base_path      /var/spool/apt-mirror/
 +
deb http://ftp.us.debian.org/debian etch main contrib non-free
 +
deb http://security.debian.org/debian-security etch/updates main contrib non-free
 +
deb http://ftp.us.debian.org/debian etch main/debian-installer
 +
</pre>
 +
 
 +
Then:
 +
mkdir -p /var/spool/apt-mirror/{mirror,var,skel}
 +
apt-mirror
  
* Run apt-mirror against the configuration file which you've created.  This will replicate the ubuntu mirror to your chosen base path (you will need to create the soft links to the dists and pool directories yourself) eg.:
+
This will replicate the mirror to your chosen base path. You will need to create the soft links to the dists and pool directories yourself, eg.:
  
 
<pre>
 
<pre>
~$ ls -al /usr/local/ubuntu/mirror
+
~$ ls -al /var/spool/apt-mirror/mirror/
 
total 24
 
total 24
 
drwxr-xr-x  5 root root  4096 May 18 12:46 .
 
drwxr-xr-x  5 root root  4096 May 18 12:46 .
Line 149: Line 218:
 
</pre>
 
</pre>
  
* Serve the /usr/local/ubuntu directory out with apache
+
* Serve the /var/spool/apt-mirror/ directory out with apache
 
 
* When you boot the ubuntu network installer, point it at the ip address and the 'mirror' directory
 
  
 +
* When you boot the ubuntu/debian network installer, point it at the IP address and the 'mirror' directory.
  
 
=Links=
 
=Links=
* http://wiki.ubuntu.com/NetbootInstallHowto?action=fullsearch&context=180&value=pxe&titlesearch=Titles
+
* http://wiki.debian.org/PXEBootInstall a similar description in another order that facilitates debugging
* http://www.debianplanet.com/node.php?id=818&cid=13384
+
* https://help.ubuntu.com/community/Installation/Netboot
 
+
* http://www.vercot.com/~serva/howto/UbuntuPXE1.html
 
[[Category:Infos]]
 
[[Category:Infos]]

Latest revision as of 11:43, 1 February 2012

Howto

Installing Ubuntu or Debian via PXE network boot is the way to go if you have no cd-r at hand, or if you have no cdrom drive on the machine to be installed.

Install services

You need the following packages:

  • tftpd-hpa
  • dhcp3-server
  • netkit-inetd
sudo apt-get install tftpd-hpa dhcp3-server openbsd-inetd

Note: On Gutsy (7.10) and Debian Etch netkit-inetd is a "virtual package". Either inetutils-inetd or openbsd-inetd must be chosen. On one system, openbsd-inetd is already installed - the default now?

Prepare your tftp server

Start your tftpd server via inetd after adding the following line in /etc/inetd.conf:

tftp           dgram   udp     wait    root  /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot
sudo update-inetd --enable BOOT

Don't forget to create the tftp directory /var/lib/tftpboot (if it hasn't already been created)

On Ubuntu 6.06 Server and Feisty Fawn 7.04 (or if /etc/inetd.conf doesn't exist) you might edit /etc/default/tftpd-hpa:

RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"

and start the daemon via the command

 sudo /etc/init.d/tftpd-hpa start

Verify that inetd is listening on the right port:

netstat -lu

should show

udp        0      0 *:tftp                  *:*      

(On one Gutsy system, inetutils-inetd insisted on listening on an ipv6 socket, and booting via tftp failed. Switching to openbsd-inetd solved the problem.)

Prepare your dhcp-server

On what network interfaces should the DHCP server (dhcpd) serve DHCP requests? Answer this question by editing the line in /etc/default/dhcp3-server file. Separate multiple interfaces with spaces, e.g. "eth0 eth1". Eg:

INTERFACES="eth1 eth2"

If you have a working dhcp server add the following lines to your group in /etc/dhcpd.conf file (or, from Etch and Feisty upward, the /etc/dhcp3/dhcpd.conf file), substituting IP and MAC address as needed. Beware not to forget the semicolons (";") at the end of lines.

host pxeinstall {
  # ie. "hardware ethernet 00:0A:E4:2E:A6:42;"
  hardware ethernet [MAC address of PXE client networkcard, without brackets];

  # this is the unused IP address we will assign temporarily to the PXE client
  fixed-address 10.0.0.16;

  # Not needed if the tftp server is on the same host as the DHCP server. ie. "next-server 10.0.0.2;".
  # edit : Well needed, otherwise he is looking for the host 0.0.0.0 so, it doesn't work
  next-server [ip-address of the server serving tftp]; 

  # path of the bootloader file, relative to tftpd's root
  filename "pxelinux.0";
}

The "next-server" stanza tells the PXE boot client where to look for the boot image and associated data. It is required in newer editions of tftpd-hpa, if not on the same machine as the DHCP server.

Instead, if you do not need MAC-based configuration (e.g. you want to be able to boot any host), you can just add a filename stanza to a subnet configuration (verified on Intrepid):

subnet 192.168.0.0 netmask 255.255.255.0 {
  range 192.168.0.100 192.168.0.254;
  option routers 192.168.0.1;
 
  #substitute the DNS addresses of your own Internet Service Provider (ISP)
  option domain-name-servers primary.dns.from.isp, secondary.dns.from.isp;
 
  filename "pxelinux.0";
}

You need to assign the client an IP address in the same subnet as the address of the server running tftpd. For example, if your server's address is 192.168.2.13, you should assign your client an IP address that begins with 192.168.2.x, NOT 192.168.0.x . If your client doesn't recieve an IP-address, you might want to add authoritative; above the subnet declaration.

When you are done configuring your dhcp server, (re)start it:

/etc/init.d/dhcp3-server restart

And verify it runs (if not, you may have a problem in the dhcpd config file):

ps ax | grep dhcpd

Prepare netboot files

Get and install the files

All the files you need are on the install media, or you can get them from internet:

Download and put the netboot directory content at the root of the tftpd's served /var/lib/tftpboot/ directory:

cd /var/lib/tftpboot/
lftp -c "open http://archive.ubuntu.com/ubuntu/dists/lucid/main/installer-i386/current/images/netboot/; mirror"

# then untar the pxeboot.tar.gz (this step is NOT needed anymore, as of Feisty)
tar xfz pxeboot.tar.gz

Alternatively, if Ubuntu is in your cdrom drive:

mount /media/cdrom
cp -a /media/cdrom/install/netboot/* /var/lib/tftpboot/

pxe bootloader config

In the pxelinux.cfg/ directory, make a symlink named after the pxe boot client's mac address (without the colons), and pointing to the "default" config file:

# ie. if our client mac address is 00:0A:E4:2E:A6:42, we'll do:
ln -s /var/lib/tftpboot/pxelinux.cfg/default /var/lib/tftpboot/pxelinux.cfg/000AE42EA642

For very old distros versions, you may need to edit or patch pxelinux.cfg/default . This modification is NOT needed anymore (at least from Feisty or Etch and up).

--- default.org	2004-10-31 15:32:32.000000000 +0100
+++ default	2004-10-31 00:14:52.000000000 +0200
@@ -13,17 +13,11 @@
 F0 debian-installer/boot-screens/f10.txt
 
 label linux
-	kernel debian-installer/linux
-	append vga=normal initrd=debian-installer/initrd.gz ramdisk_size=11057 root=/dev/rd/0 devfs=mount,dall rw --
+	kernel vmlinuz
+	append vga=normal initrd=initrd.gz ramdisk_size=11057 root=/dev/rd/0 devfs=mount,dall rw --
 label expert
-	kernel debian-installer/linux
-	append DEBCONF_PRIORITY=low vga=normal initrd=debian-installer/initrd.gz ramdisk_size=11057 root=/dev/rd/0 devfs=mount,dall rw --
-label custom
-	kernel debian-installer/linux
-	append ubuntu/install-type=custom vga=normal initrd=debian-installer/initrd.gz ramdisk_size=11057 root=/dev/rd/0 devfs=mount,dall rw --
-label custom-expert
-	kernel debian-installer/linux
-	append ubuntu/install-type=custom DEBCONF_PRIORITY=low vga=normal initrd=debian-installer/initrd.gz ramdisk_size=11057 root=/dev/rd/0 devfs=mount,dall rw --
+	kernel vmlinuz
+	append DEBCONF_PRIORITY=low vga=normal initrd=initrd.gz ramdisk_size=11057 root=/dev/rd/0 devfs=mount,dall rw --
 
 prompt 1
 timeout 0

Directory layout

Should look like this, more or less (depending on the Ubuntu or Debian installer version used):

/var/lib/tftpboot/
/var/lib/tftpboot/pxelinux.0
/var/lib/tftpboot/initrd.gz
/var/lib/tftpboot/mini.iso
/var/lib/tftpboot/debian-installer
/var/lib/tftpboot/debian-installer/linux
/var/lib/tftpboot/debian-installer/initrd.gz
/var/lib/tftpboot/debian-installer/boot-screens
/var/lib/tftpboot/debian-installer/boot-screens/splash.rle
/var/lib/tftpboot/debian-installer/boot-screens/f1.txt
/var/lib/tftpboot/debian-installer/boot-screens/f2.txt
/var/lib/tftpboot/debian-installer/boot-screens/f3.txt
/var/lib/tftpboot/debian-installer/boot-screens/f4.txt
/var/lib/tftpboot/debian-installer/boot-screens/f5.txt
/var/lib/tftpboot/debian-installer/boot-screens/f6.txt
/var/lib/tftpboot/debian-installer/boot-screens/f7.txt
/var/lib/tftpboot/debian-installer/boot-screens/f8.txt
/var/lib/tftpboot/debian-installer/boot-screens/f9.txt
/var/lib/tftpboot/debian-installer/boot-screens/syslinux.txt
/var/lib/tftpboot/debian-installer/boot-screens/f10.txt
/var/lib/tftpboot/initrd.list
/var/lib/tftpboot/vmlinuz
/var/lib/tftpboot/pxelinux.cfg
/var/lib/tftpboot/pxelinux.cfg/default
/var/lib/tftpboot/pxelinux.cfg/000AE42EA642

In more detail we need to provide:

  • a bootloader, which name (or path relative to tftpd's served directory, here /var/lib/tftpboot) is mentioned in the dhcpd.conf file (pxelinux.0)
  • a configuration file for the bootloader (default for all clients, or mac specific)
  • a kernel with an initrd file (vmlinuz,initrd.gz)
  • an image of the base system (mini.iso)

Start the PXE client

Just boot up the computer that will use DHCP and then PXE to get the images, if something isn't working you can use a sniffer on your install server to check, and look at log files for daemons misconfigurations.

tshark -R bootp
tshark port tftp
sudo tcpdump -s 1600 -neeevvvX 'proto (\udp or \tcp) and port (67 or 68 or 69)'
tail /var/log/daemon.log

If your network card doesn't have a PXE stack, you can try downloading a stub client from http://rom-o-matic.net/

Optional: setup an archive mirror

With the previous setup, Ubuntu or Debian will download install packages straight over the internet. If you prefer to run your network installs over a private network and use your own Ubuntu or Debian mirror you can do the following:

sudo apt-get install apt-mirror

Then write an /etc/apt/mirror.list configuration file, eg.:

Example for Ubuntu dapper:

set base_path      /var/spool/apt-mirror/
deb http://gb.archive.ubuntu.com/ubuntu/ dapper main restricted
deb http://gb.archive.ubuntu.com/ubuntu/ dapper main/debian-installer
deb http://gb.archive.ubuntu.com/ubuntu/ dapper main restricted/debian-installer

Example for Debian Etch:

set base_path      /var/spool/apt-mirror/
deb http://ftp.us.debian.org/debian etch main contrib non-free
deb http://security.debian.org/debian-security etch/updates main contrib non-free
deb http://ftp.us.debian.org/debian etch main/debian-installer

Then:

mkdir -p /var/spool/apt-mirror/{mirror,var,skel}
apt-mirror

This will replicate the mirror to your chosen base path. You will need to create the soft links to the dists and pool directories yourself, eg.:

~$ ls -al /var/spool/apt-mirror/mirror/
total 24
drwxr-xr-x   5 root root   4096 May 18 12:46 .
drwxrwxrwx  11 root root   4096 May 18 12:27 ..
lrwxrwxrwx   1 root root   34 May 18 12:46 dists -> gb.archive.ubuntu.com/ubuntu/dists
drwxr-xr-x   3 root root   4096 May 18 12:46 gb.archive.ubuntu.com
lrwxrwxrwx   1 root root   33 May 18 12:46 pool -> gb.archive.ubuntu.com/ubuntu/pool
drwxr-xr-x   3 root root   4096 May 18 10:53 skel
drwxr-xr-x   2 root root   8192 May 18 13:27 var
  • Serve the /var/spool/apt-mirror/ directory out with apache
  • When you boot the ubuntu/debian network installer, point it at the IP address and the 'mirror' directory.

Links