Difference between revisions of "Install Arch from network via PXE"

From ArchWiki
Jump to: navigation, search
(Corrected names of necessary packages to install)
(Expanded; Clarified some points; Grammar corrections)
Line 5: Line 5:
 
= Network booting =
 
= Network booting =
  
Did your tiny laptop come without a CDROM drive, and doesn't allow you to boot from a usb drive? Fear not, you can boot using pxe and a usb drive:
+
Did your tiny laptop come without a CDROM drive, and doesn't allow you to boot from a usb drive? Fear not, you can boot using pxe and a USB Key or USB Drive:
  
 
== Requisites ==
 
== Requisites ==
Line 14: Line 14:
 
* the Arch Linux [http://www.archlinux.org/download/ usb installation image] (either ftp or core will work)
 
* the Arch Linux [http://www.archlinux.org/download/ usb installation image] (either ftp or core will work)
  
Install all necessary stuff:
+
The DHCP and tftp server can be the same computer if you only have one.
 +
 
 +
Install all necessary programs on the existing ArchLinux computer which will act as the server for the installation on your client
 +
 
 +
If you want to use DHCPD:
 
  pacman -Sy mkpxelinux tftp-hpa dhcp
 
  pacman -Sy mkpxelinux tftp-hpa dhcp
 +
 +
If you want to use DNSMasq:
 +
pacman -Sy mkpxelinux tftp-hpa dnsmasq
  
 
== Preparing dhcpd ==
 
== Preparing dhcpd ==
  
Make sure your DHCP server is able to tell your clients where to find the TFTPd running.
+
Make sure your DHCP server is able to tell your clients where to find the TFTPd server.
 
 
Using ISC dhcpd (edit your /etc/dhcpd.conf):
 
  
 +
DHCPD: edit your /etc/dhcpd.conf file:
 
  subnet 192.168.42.0 netmask 255.255.255.0 {
 
  subnet 192.168.42.0 netmask 255.255.255.0 {
 
   allow bootp;                  # accept bootp requests
 
   allow bootp;                  # accept bootp requests
Line 29: Line 35:
 
  }
 
  }
  
Using dnsmasq:
+
DNSMasq: edit your /etc/dnsmasq.conf file:
 
 
  dhcp-boot=pxelinux.0,<tftp-server-hostname>,<tftp-server-IP>
 
  dhcp-boot=pxelinux.0,<tftp-server-hostname>,<tftp-server-IP>
  
 
== Preparing tftpd ==
 
== Preparing tftpd ==
  
Run <code>mkpxelinux</code>, which will put stuff to boot in <code>/var/tftpboot</code>.
+
Run <code>mkpxelinux</code>, which will put the required boot files in <code>/var/tftpboot</code>.
  
 
  ~# mkpxelinux -a
 
  ~# mkpxelinux -a
  
Assuming you downloaded the usb install img to /home/yourname, we're going to mount the image, copy the kernel and desired initrd into the tftp environment, typically found in <code>/var/tftpboot</code>.
+
Assuming you downloaded the USB install .img file to /home/yourname, we're going to mount the image, copy the kernel and desired initrd into the tftp environment we created above using <code>mkpxelinux</code>.
  
 
  ~# cd /var/tftpboot
 
  ~# cd /var/tftpboot
 
  /var/tftpboot# mkdir temp
 
  /var/tftpboot# mkdir temp
 
  /var/tftpboot# mount -t ext2 -o ro,loop,offset=32256 /home/yourname/archlinux-2008.06-core-i686.img temp/
 
  /var/tftpboot# mount -t ext2 -o ro,loop,offset=32256 /home/yourname/archlinux-2008.06-core-i686.img temp/
  /var/tftpboot# cp temp/boot/{archlive.img,vmlinuz26} ./
+
  /var/tftpboot# cp temp/boot/archlive.img ./
 +
/var/tftpboot# cp temp/boot/vmlinuz26 ./
  
== Create a pxelinux config ==
+
== Create pxelinux config ==
  
Create a pxelinux bootloader config including the options found in the "boot Archlive" section of menu.lst. Edit /var/tftpboot/temp/boot/grub/menu.lst.
+
Create a pxelinux bootloader config including the options found in the "Boot Archlive" section of menu.lst.
 +
 
 +
Copy the information required for the last 2 lines below from the /var/tftpboot/temp/boot/grub/menu.lst file.
  
 
  # /var/tftpboot/pxelinux.cfg/default
 
  # /var/tftpboot/pxelinux.cfg/default
Line 58: Line 66:
 
  default arch
 
  default arch
 
  label arch
 
  label arch
  kernel vmlinuz26            # Line changed acording to data in menu.lst
+
  kernel vmlinuz26            # Change line according to menu.lst
  append initrd=archlive.img  # Line changed acording to data in menu.lst
+
  append initrd=archlive.img  # Change line according to menu.lst
  
 
== Cleanup ==
 
== Cleanup ==
  
 
  /var/tftpboot# umount temp && rmdir temp
 
  /var/tftpboot# umount temp && rmdir temp
  /var/tftpboot# cp /usr/share/mkpxelinux/pxelinux.0 .
+
  /var/tftpboot# cp /usr/share/mkpxelinux/pxelinux.0 ./
  
 
== Configuring host.allow ==
 
== Configuring host.allow ==
  
Add following records in /etc/hosts.allow.
+
Add following records to your /etc/hosts.allow file:
  
 
  # /etc/hosts.allow
 
  # /etc/hosts.allow
Line 78: Line 86:
 
== Drive containing the root image  ==
 
== Drive containing the root image  ==
  
==== Creating usb drive ====
+
==== Creating USB Boot Drive ====
 
 
Beginning from release 2008.06, USB images are provided. Download them from your local mirror (they are the .img files). To install, use the following command:
 
 
 
# dd if=image.img of=/dev/sd[x]
 
 
 
where image.img is the path to the img file and /dev/sd[x] is your USB device. Make sure to use /dev/sdx and not /dev/sdx1.
 
 
 
Note: This will irrevocably delete all files on your USB stick, so make sure you don't have any important files on the stick before doing this.
 
 
 
You can find other ways of creating usb disk here [[http://wiki.archlinux.org/index.php/Install_from_USB_stick]].
 
 
 
You will need a drive attached via usb containing the squashfs image used as /
 
  
As of 2008.06 the usb installer will only look in usb storage devices for this root filesystem image. if it cannot find this image the installer will panic.  
+
Beginning from release 2008.06, USB images are provided. Download them from your local mirror (they are the files with the .img extension). They can be copied to any USB storage ready for installation such as a USB 'Memory Stick' or a USB Hard Drive.
  
The simplest way is to plug in a normal usb installer before booting. created as outlined in the arch install guide. but since you are not booting from the usb image directly, only the _files_ in the partition are really required.  
+
To install to image to a USB drive ready for booting, use the following command.
  
If you want to create a custom image: for the 2008.06 usb installer, it's layout is as follows: the first partition, is formatted as ext2 to contain the files.
+
'''WARNING: this will erase all data on the device you type after <code>of=</code>'''
  
FIXME: find out if any ext2 partition will work not just the first one on the drive.
+
Ensure you are using the correct device name. Note that we want to copy the image to a whole drive, not just a partition, so do [[NOT]] include a number after the device name (eg, /dev/sdb and not /dev/sdb1)
  
FIXME: add step by step.
+
# dd if=/path/to/downloaded/image.img of=/dev/sd[x]
  
== Using it ==
+
where /path/to/downloaded/image.img is the path to the img file you downloaded and /dev/sd[x] is your USB device.
  
Now make sure the <code>dhcpd</code> and <code>tftpd</code> daemons are running. Boot your destination machine over PXE (usually something like F12 (on Dells) or F11 (on Supermicro's), or enable it in the BIOS).
+
You can find other ways of creating a USB Boot Disk here [[http://wiki.archlinux.org/index.php/Install_from_USB_stick]].
  
Execute:
+
= Starting the Install =
  
 +
Now make sure the <code>dhcpd</code> and <code>tftpd</code> daemons are running on the server.
 
  # /etc/rc.d/tftpd start
 
  # /etc/rc.d/tftpd start
 
  # dhcpd
 
  # dhcpd
  
Start target computer and start install.
+
Boot your destination machine over PXE (usually something like F12 (on Dells) or F11 (on Supermicro's), or enable it in the BIOS).
  
When you get the PXEBoot prompt, type 'arch' or hit return to start the installer. the install should now progress the same as if you booted from the usb drive.
+
When you get the PXEBoot prompt, type 'arch' or hit return to start the installer. The install should now progress the same as if you booted from the USB drive. You can continue installation by following the [[Official_Arch_Linux_Install_Guide]]
  
 
That's all!
 
That's all!

Revision as of 03:35, 2 December 2008

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Install Arch from network via PXE#)

Network booting

Did your tiny laptop come without a CDROM drive, and doesn't allow you to boot from a usb drive? Fear not, you can boot using pxe and a USB Key or USB Drive:

Requisites

You need at least the following:

  • a server capable of running ISC DHCPD or DNSMasq
  • a server capable of running (a)tftpd
  • the Arch Linux usb installation image (either ftp or core will work)

The DHCP and tftp server can be the same computer if you only have one.

Install all necessary programs on the existing ArchLinux computer which will act as the server for the installation on your client

If you want to use DHCPD:

pacman -Sy mkpxelinux tftp-hpa dhcp

If you want to use DNSMasq:

pacman -Sy mkpxelinux tftp-hpa dnsmasq

Preparing dhcpd

Make sure your DHCP server is able to tell your clients where to find the TFTPd server.

DHCPD: edit your /etc/dhcpd.conf file:

subnet 192.168.42.0 netmask 255.255.255.0 {
 allow bootp;                  # accept bootp requests
 filename "pxelinux.0";        # the PXELinux boot agent
 next-server <tftp-server-IP>; # where does tftp live?
}

DNSMasq: edit your /etc/dnsmasq.conf file:

dhcp-boot=pxelinux.0,<tftp-server-hostname>,<tftp-server-IP>

Preparing tftpd

Run mkpxelinux, which will put the required boot files in /var/tftpboot.

~# mkpxelinux -a

Assuming you downloaded the USB install .img file to /home/yourname, we're going to mount the image, copy the kernel and desired initrd into the tftp environment we created above using mkpxelinux.

~# cd /var/tftpboot
/var/tftpboot# mkdir temp
/var/tftpboot# mount -t ext2 -o ro,loop,offset=32256 /home/yourname/archlinux-2008.06-core-i686.img temp/
/var/tftpboot# cp temp/boot/archlive.img ./
/var/tftpboot# cp temp/boot/vmlinuz26 ./

Create pxelinux config

Create a pxelinux bootloader config including the options found in the "Boot Archlive" section of menu.lst.

Copy the information required for the last 2 lines below from the /var/tftpboot/temp/boot/grub/menu.lst file.

# /var/tftpboot/pxelinux.cfg/default
prompt 1
timeout 10
display boot.msg
F1 boot.msg
F2 options.msg
default arch
label arch
kernel vmlinuz26             # Change line according to menu.lst
append initrd=archlive.img   # Change line according to menu.lst

Cleanup

/var/tftpboot# umount temp && rmdir temp
/var/tftpboot# cp /usr/share/mkpxelinux/pxelinux.0 ./

Configuring host.allow

Add following records to your /etc/hosts.allow file:

# /etc/hosts.allow
tftpd: ALL
in.tftpd: ALL

Your Arch Linux network installer is now ready.

Drive containing the root image

Creating USB Boot Drive

Beginning from release 2008.06, USB images are provided. Download them from your local mirror (they are the files with the .img extension). They can be copied to any USB storage ready for installation such as a USB 'Memory Stick' or a USB Hard Drive.

To install to image to a USB drive ready for booting, use the following command.

WARNING: this will erase all data on the device you type after of=

Ensure you are using the correct device name. Note that we want to copy the image to a whole drive, not just a partition, so do NOT include a number after the device name (eg, /dev/sdb and not /dev/sdb1)

# dd if=/path/to/downloaded/image.img of=/dev/sd[x]

where /path/to/downloaded/image.img is the path to the img file you downloaded and /dev/sd[x] is your USB device.

You can find other ways of creating a USB Boot Disk here [[1]].

Starting the Install

Now make sure the dhcpd and tftpd daemons are running on the server.

# /etc/rc.d/tftpd start
# dhcpd

Boot your destination machine over PXE (usually something like F12 (on Dells) or F11 (on Supermicro's), or enable it in the BIOS).

When you get the PXEBoot prompt, type 'arch' or hit return to start the installer. The install should now progress the same as if you booted from the USB drive. You can continue installation by following the Official_Arch_Linux_Install_Guide

That's all!