Difference between revisions of "Archiso as pxe server"

From ArchWiki
Jump to: navigation, search
(Redirected page to PXE)
(Undo revision 224462 by Buhman (talk) /* why removed this? lots of examples was not present in PXE.)
Line 1: Line 1:
#REDIRECT[[PXE]]
+
[[Category:Live Arch systems]]
 +
[[fr:Install PXE]]
 +
{{merge|Install Arch from network (via PXE)|other article has better explanation, but this one is more up to date}}
 +
 
 +
This small HOWTO will show you how to setup a live environment that can act as server for Arch Linux live media. Once you have done all these steps, Arch Linux live media is able to boot via PXE on your network.
 +
 
 +
 
 +
== HTTP and NFS ==
 +
 
 +
Due recent changes in archiso, is now posible to boot from HTTP (archiso_pxe_http initcpio hook) or NFS (archiso_pxe_nfs initcpio hook). Also some changes was made in syslinux configs files from configs/releng, that enable mounted media acts directly as "pxeroot", nothing change is needed, only if you want to customize for particular purpose.
 +
 
 +
First mount .iso in some place.
 +
{{Note|Inside live-enviroment skip this step, .iso in mounted on '''/run/archiso/bootmnt''' when copytoram is not used.}}
 +
{{bc|1=# mkdir -p /run/archiso/bootmnt
 +
# mount -o ro archlinux-2012.07.15-netinstall-dual.iso /run/archiso/bootmnt}}
 +
 
 +
* Setup DHCP and TFTP servers
 +
{{Note|Last slash is important}}
 +
{{bc|1=# dnsmasq --port=0 \
 +
          --enable-tftp \
 +
          --tftp-root=/run/archiso/bootmnt \
 +
          --dhcp-range=192.168.0.2,192.168.0.254,86400 \
 +
          --dhcp-boot=/arch/boot/syslinux/gpxelinux.0 \
 +
          --dhcp-option-force=209,boot/syslinux/archiso.cfg \
 +
          --dhcp-option-force=210,/arch/}}
 +
 
 +
* Setup a DHCP server only for HTTP
 +
{{Note|This can be used only from PXE roms that undertands HTTP and DNS (if domain-name is used instead of IP address).
 +
Alternativelly you can use gPXE (it just takes fews KiBs): [http://rom-o-matic.net/gpxe/gpxe-git/gpxe.git/contrib/rom-o-matic/ ROM-o-matic.net dynamically generates gPXE images]. Should considere that gPXE is not activelly maintained, [http://ipxe.org/ iPXE] is the active fork, but there is no online generator}}
 +
{{Note|Last slash is important}}
 +
{{bc|1=# dnsmasq --port=0 \
 +
          --dhcp-range=192.168.0.2,192.168.0.254,86400 \
 +
          --dhcp-boot=http://192.168.0.7/arch/boot/syslinux/gpxelinux.0 \
 +
          --dhcp-option-force=209,boot/syslinux/archiso.cfg \
 +
          --dhcp-option-force=210,http://192.168.0.7/arch/}}
 +
 
 +
* Setup gPXE/iPXE only
 +
{{Note|For example if you are currently using a DHCP from your internet router}}
 +
 
 +
Go to [http://rom-o-matic.net/gpxe/gpxe-git/gpxe.git/contrib/rom-o-matic/ ROM-o-matic.net dynamically generates gPXE images], select customize, and write this script as "Embedded Script"
 +
 
 +
{{bc|1=#!gpxe
 +
dhcp
 +
set 209:string boot/syslinux/archiso.cfg
 +
set 210:string http://192.168.0.7/arch/
 +
chain ${210:string}boot/syslinux/gpxelinux.0
 +
boot}}
 +
 
 +
Must download [http://ipxe.org/download iPXE]
 +
{{bc|1=#!ipxe
 +
dhcp
 +
set 209:string boot/syslinux/archiso.cfg
 +
set 210:string http://192.168.0.7/arch/
 +
chain ${210:string}boot/syslinux/gpxelinux.0
 +
boot}}
 +
 
 +
 
 +
* Setup HTTP server
 +
Setup any HTTP server that you want, just point the root to /mnt/iso. For example using darkhttpd:
 +
{{bc|1=# darkhttpd /run/archiso/bootmnt}}
 +
 
 +
* Setup NFS server
 +
Add an entry like this to /etc/exports
 +
{{bc|1=/run/archiso/bootmnt 192.168.0.*(ro,no_subtree_check,no_root_squash)}}
 +
 
 +
Then start NFS server
 +
{{bc|1=rc.d start rpcbind nfs-common nfs-server}}
 +
 
 +
* Setup NBD server
 +
Create a file /tmp/nbd-server.conf
 +
{{bc|1=
 +
[generic]
 +
[archiso]
 +
    readonly = true
 +
    exportname = /dev/disk/by-label/ARCH_201208
 +
}}
 +
 
 +
Then start NBD server
 +
{{bc|1=
 +
nbd-server -C /tmp/nbd-server.conf
 +
}}
 +
 
 +
== See also ==
 +
*[[Archiso]]

Revision as of 17:06, 22 September 2012

Merge-arrows-2.pngThis article or section is a candidate for merging with Install Arch from network (via PXE).Merge-arrows-2.png

Notes: other article has better explanation, but this one is more up to date (Discuss in Talk:Archiso as pxe server#)

This small HOWTO will show you how to setup a live environment that can act as server for Arch Linux live media. Once you have done all these steps, Arch Linux live media is able to boot via PXE on your network.


HTTP and NFS

Due recent changes in archiso, is now posible to boot from HTTP (archiso_pxe_http initcpio hook) or NFS (archiso_pxe_nfs initcpio hook). Also some changes was made in syslinux configs files from configs/releng, that enable mounted media acts directly as "pxeroot", nothing change is needed, only if you want to customize for particular purpose.

First mount .iso in some place.

Note: Inside live-enviroment skip this step, .iso in mounted on /run/archiso/bootmnt when copytoram is not used.
# mkdir -p /run/archiso/bootmnt
# mount -o ro archlinux-2012.07.15-netinstall-dual.iso /run/archiso/bootmnt
  • Setup DHCP and TFTP servers
Note: Last slash is important
# dnsmasq --port=0 \
          --enable-tftp \
          --tftp-root=/run/archiso/bootmnt \
          --dhcp-range=192.168.0.2,192.168.0.254,86400 \
          --dhcp-boot=/arch/boot/syslinux/gpxelinux.0 \
          --dhcp-option-force=209,boot/syslinux/archiso.cfg \
          --dhcp-option-force=210,/arch/
  • Setup a DHCP server only for HTTP
Note: This can be used only from PXE roms that undertands HTTP and DNS (if domain-name is used instead of IP address). Alternativelly you can use gPXE (it just takes fews KiBs): ROM-o-matic.net dynamically generates gPXE images. Should considere that gPXE is not activelly maintained, iPXE is the active fork, but there is no online generator
Note: Last slash is important
# dnsmasq --port=0 \
          --dhcp-range=192.168.0.2,192.168.0.254,86400 \
          --dhcp-boot=http://192.168.0.7/arch/boot/syslinux/gpxelinux.0 \
          --dhcp-option-force=209,boot/syslinux/archiso.cfg \
          --dhcp-option-force=210,http://192.168.0.7/arch/
  • Setup gPXE/iPXE only
Note: For example if you are currently using a DHCP from your internet router

Go to ROM-o-matic.net dynamically generates gPXE images, select customize, and write this script as "Embedded Script"

#!gpxe
dhcp
set 209:string boot/syslinux/archiso.cfg
set 210:string http://192.168.0.7/arch/
chain ${210:string}boot/syslinux/gpxelinux.0
boot

Must download iPXE

#!ipxe
dhcp
set 209:string boot/syslinux/archiso.cfg
set 210:string http://192.168.0.7/arch/
chain ${210:string}boot/syslinux/gpxelinux.0
boot


  • Setup HTTP server

Setup any HTTP server that you want, just point the root to /mnt/iso. For example using darkhttpd:

# darkhttpd /run/archiso/bootmnt
  • Setup NFS server

Add an entry like this to /etc/exports

/run/archiso/bootmnt 192.168.0.*(ro,no_subtree_check,no_root_squash)

Then start NFS server

rc.d start rpcbind nfs-common nfs-server
  • Setup NBD server

Create a file /tmp/nbd-server.conf

[generic]
[archiso]
    readonly = true
    exportname = /dev/disk/by-label/ARCH_201208

Then start NBD server

nbd-server -C /tmp/nbd-server.conf

See also