PXE

From ArchWiki
Revision as of 04:01, 22 September 2012 by Buhman (talk | contribs) (Installation)
Jump to: navigation, search

Preparation

Unlike older methods, recent changes in Archiso make it fairly trivial to use the official install media directly to set up PXE booting.

Download the latest official install media from your favorite mirror.

$ wget http://hive.ist.unomaha.edu/archlinux/iso/latest/archlinux-2012.09.07-dual.iso
--2012-09-21 22:06:37--  http://hive.ist.unomaha.edu/archlinux/iso/latest/archlinux-2012.09.07-dual.iso
Resolving hive.ist.unomaha.edu... 2620:d5:0:22bb::dead:beef, 137.48.187.208
Connecting to hive.ist.unomaha.edu|2620:d5:0:22bb::dead:beef|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 411041792 (392M) [application/x-iso9660-image]
Saving to: ‘archlinux-2012.09.07-dual.iso’

100%[====================================================================================>] 411,041,792  109MB/s   in 3.6s   

2012-09-21 22:06:41 (109 MB/s) - ‘archlinux-2012.09.07-dual.iso’ saved [411041792/411041792]

Next mount the image:

# mkdir -p /mnt/archiso
# mount -o loop,ro archlinux-2012.09.07-dual.iso /mnt/archiso

Server setup

Network

Bring up your wired NIC, and assign it an address appropriately.

# ip l s dev eth0 up
# ip a a 192.168.0.1/24 dev eth0

DHCP + TFTP

Configure dnsmasq:

# vim /etc/dnsmasq.conf
dhcp-range=192.168.0.50,192.168.0.150,12h
dhcp-boot=/arch/boot/syslinux/pxelinux.0
enable-tftp
tftp-root=/mnt/archiso
dhcp-option-force=209,boot/syslinux/archiso.cfg
dhcp-option-force=210,/arch/

Start dnsmasq:

# systemctl start dnsmasq.service

For those still using sysvinit:

# rc.d start dnsmasq

HTTP

Due recent changes in archiso, it is now possible to boot from HTTP (archiso_pxe_http initcpio hook) or NFS (archiso_pxe_nfs initcpio hook); among all alternatives, darkhttpd is by far the most trivial to setup (and the lightest-weight).

First, install darkhttpd:

# pacman -S darkhttpd
resolving dependencies...
looking for inter-conflicts...

Targets (1): darkhttpd-1.8-2

Total Download Size:    0.01 MiB
Total Installed Size:   0.04 MiB
Net Upgrade Size:       0.00 MiB

Proceed with installation? [Y/n] 
:: Retrieving packages from community...
 darkhttpd-1.8-2-x86_64    14.8 KiB  82.4M/s 00:00 [#####################] 100%
(1/1) checking package integrity                   [#####################] 100%
(1/1) loading package files                        [#####################] 100%
(1/1) checking for file conflicts                  [#####################] 100%
(1/1) checking available disk space                [#####################] 100%
(1/1) upgrading darkhttpd                          [#####################] 100%

Then start darkhttpd using our /mnt/archiso as the document root:

# darkhttpd /mnt/archiso
darkhttpd/1.8, copyright (c) 2003-2011 Emil Mikulic.
listening on: http://0.0.0.0:80/

Installation

After you load pxelinux.0 and archiso.cfg via TFTP, you'll (hopefully) be presented with a syslinux boot menu with several options, two of which are of potential usefulness to us.

Select either

Boot Arch Linux (x86_64) (HTTP)

or

Boot Arch Linux (i686) (HTTP)

Depending on your CPU architecture.