Benutzer-Werkzeuge

Webseiten-Werkzeuge


freebsd:pxe_boot

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

freebsd:pxe_boot [2013/12/16 14:40] (aktuell)
idefix angelegt
Zeile 1: Zeile 1:
 +====== ​ PXE-Boot ​ ======
 +http:<​nowiki>//</​nowiki>​www.freebsd.org/​doc/​en_US.ISO8859-1/​articles/​pxe/​index.html, ​
 +http:<​nowiki>//</​nowiki>​www.daemonsecurity.com/​pxe/​jumpstart.html and http:<​nowiki>//</​nowiki>​www.daemonsecurity.com/​pxe/​diskless.html
 +<​code>​
 + and http://​www.daemonsecurity.com/​pub/​pxeboot/</​code>​
 +
 +http:<​nowiki>//</​nowiki>​www.freebsd.org/​doc/​en_US.ISO8859-1/​books/​handbook/​network-diskless.html
 +
 +
 +=====  Autoinstall ​ =====
 +To setup PXEBoot to autoinstall a FreeBSD:
 +<​code>​
 +mdconfig -a -t vnode -f kern.flp -u 0 # (vnconfig vn0 kern.flp) associate a vndevice with the file
 +mount /dev/md0 /mnt/test # (mount /dev/vn0 /mnt) mount it
 +cp -R /mnt /​usr/​tftp/​boot # copy the contents to /​usr/​tftpboot
 +umount /mnt              # unmount it
 +mdconfig -d -u 0         # disassociate the vndevice from the file
 +
 +mdconfig -a -t vnode -f mfsroot.flp -u 0
 +mount /dev/md0 /​mnt/​test ​             # mount it
 +cp /​mnt/​test/​mfsroot.gz /​usr/​tftp/​boot # copy the contents to /​usr/​tftp/​boot
 +umount /​mnt/​test ​                    # unmount it
 +mdconfig -d -u 0                  # disassociate the vndevice from the file
 +cd /​usr/​tftp/​boot ​                # get into the pxeboot directory
 +gunzip mfsroot.gz ​               # uncompress the mfsroot
 +
 +cd /​usr/​tftp/​boot
 +mdconfig -a -t vnode -f mfsroot -u 0
 +mount /dev/md0 /mnt/test
 +cp /​root/​install.cfg /mnt/test
 +umount /mnt/test
 +mdconfig -d -u 0
 +</​code>​
 +
 +=====  Diskless client ​ =====
 +Make a diskless client:
 +====  Building the base system ​ ====
 +<​code>​
 +cd /usr/src
 +make buildworld
 +make DESTDIR=/​usr/​local/​diskless/​FreeBSD installworld
 +make DESTDIR=/​usr/​local/​diskless/​FreeBSD distribution
 +</​code>​
 +
 +====  Building a custom kernel ​ ====
 +<​code>​
 +cd /​usr/​src/​sys/​i386/​conf
 +cp GENERIC DISKLESS
 +</​code>​
 +
 +Add the following lines to the kernel configuration:​
 +<​code>​
 +# Filesystems
 +options ​        ​PSEUDOFS ​       # Pseudo-filesystem framework
 +options ​        ​NFSCLIENT ​      # NFS filesystem support
 +options ​        ​NFS_ROOT ​       # NFS is a posible root device
 +
 +# Memory pseudo devices
 +device ​         mem             # Memory and kernel memory devices
 +device ​         md              # Memory "​disks"​
 +
 +# NETWORKING OPTIONS
 +options ​        ​BOOTP ​          # BOOTP is only needed to get hostname ​
 +</​code>​
 +
 +Now build the kernel with
 +<​code>​
 +cd /usr/src
 +make KERNCONF=DISKLESS buildkernel
 +</​code>​
 +Installing the boot files:
 +<​code>​
 +mkdir -p /​usr/​local/​diskless/​FreeBSD/​boot/​defaults
 +cp /​boot/​defaults/​loader.conf /​usr/​local/​diskless/​FreeBSD/​boot/​defaults/​
 +cp /​usr/​src/​sys/​boot/​i386/​loader/​loader.rc /​usr/​local/​diskless/​FreeBSD/​boot/​
 +cp /​usr/​src/​sys/​i386/​conf/​GENERIC.hints /​usr/​local/​diskless/​FreeBSD/​boot/​device.hints
 +</​code>​
 +
 +Install the kernel:
 +<​code>​
 +make KERNCONF=DISKLESS DESTDIR=/​usr/​local/​diskless/​FreeBSD installkernel
 +</​code>​
 +
 +====  Installing tftp  ====
 +Copy the files:
 +<​code>​
 +cp /​usr/​local/​diskless/​FreeBSD/​boot/​pxeboot /​usr/​local/​tftp/​boot/​
 +</​code>​
 +Enable tftp in the inetd.conf
 +<​code>​
 +tftp    dgram   udp wait    nobody ​ /​usr/​libexec/​tftpd ​ tftpd -l -s /​usr/​local/​tftp
 +</​code>​
 +
 +====  Setting up dhcp server ​ ====
 +Put the following lines into the dhcpd.conf:
 +<​code>​
 +filename "​boot/​pxeboot";​
 +subnet 192.168.0.0 netmask 255.255.255.0 {
 +     ​next-server 192.168.0.251;​
 +     ​option root-path "​192.168.0.251:/​usr/​local/​diskless/​FreeBSD";​
 +}
 +</​code>​
 +
 +====  Setting up the NFS server ​ ====
 +Edit the /​etc/​exports and add the following lines:
 +<​code>​
 +# for pxe boot
 +/​usr/​local/​diskless/​FreeBSD ​   -alldirs ​   -ro
 +/usr    -alldirs ​   -ro
 +</​code>​
 +
 +====  Disable ACPI  ====
 +Edit the file /​usr/​local/​diskless/​FreeBSD/​boot/​loader.conf.local:​
 +<​code>​
 +verbose_loading="​YES" ​           # Set to YES for verbose loader output
 +autoboot_delay=2
 +hint.acpi.0.disabled="​1"​
 +</​code>​
 +If you boot the diskless system now, it should load the kernel and boot up to the login prompt with some error messages.
 +
 +====  Configure the diskless client ​ ====
 +At first we chroot to avoid confusion about pathes:
 +<​code>​
 +cd /​usr/​local/​diskless
 +chroot FreeBSD/
 +</​code>​
 +
 +To enable syslog edit /​etc/​rc.conf:​
 +<​code>​
 +syslogd_enable="​YES" ​           # Run syslog daemon (or NO).
 +</​code>​
 +
 +Edit /​etc/​syslog.conf and put only these lines into it:
 +<​code>​
 +*.err;​kern.warning;​auth.notice;​mail.crit ​       /​dev/​console
 +*.*                                             ​@server.idefix.loc
 +</​code>​
 +
 +After the @ put the hostname which should receive the logs.
 +
 +Disable cron and enable ntp for time syncronization,​ edit /​etc/​rc.conf:​
 +<​code>​
 +cron_enable="​NO" ​               # Run the periodic job daemon.
 +ntpdate_enable="​YES" ​           # Run ntpdate to sync time on boot (or NO).
 +ntpdate_hosts="​192.168.0.251" ​  # ntp server to use for ntpdate
 +</​code>​
 +
 +Configure the filesystems in the file /etc/fstab:
 +<​code>​
 +# Device ​                                  ​Mount ​ FStype ​ Options ​      ​Dump ​ Pass#
 +192.168.0.251:/​usr/​local/​diskless/​FreeBSD ​ /      nfs     ​ro ​           0     0
 +192.168.0.251:/​usr/​home ​                   /home  nfs     ​rw,​userquota ​ 0     0
 +proc                                       /​proc ​ procfs ​ rw            0     0
 +</​code>​
 +
 +To enable /tmp and /var as ram drive add to /​etc/​rc.conf:​
 +<​code>​
 +tmpmfs="​YES" ​      # Set to YES to always create an mfs /tmp, NO to never
 +varmfs="​YES" ​      # Set to YES to always create an mfs /var, NO to never
 +</​code>​
 +
 +Creating the HOME directory:
 +<​code>​
 +mkdir /home
 +</​code>​
 +
 +Set password for root account:
 +<​code>​
 +passwd root
 +</​code>​
 +
 +Create a useraccount:​
 +<​code>​
 +adduser
 +</​code>​
 +
 +Exit from the chroot.
 +
 +====  Installing software ​ ====
 +Mount the porttree via nullfs to /​usr/​local/​diskless/​FreeBSD:​
 +<​code>​
 +mount_nullfs /usr/ports/ /​usr/​local/​diskless/​FreeBSD/​usr/​ports
 +</​code>​
 +To get all software installed correctly mount /dev into the chroot environment:​
 +<​code>​
 +mount -t devfs devfs /​usr/​local/​diskless/​FreeBSD/​dev
 +</​code>​
 +
 +Now chroot with:
 +<​code>​
 +cd /​usr/​local/​diskless
 +chroot FreeBSD/
 +</​code>​
 +and install cvsup at first.
 +
 +After installing required software with the port-tree unmount the devfs again with:
 +<​code>​
 +umount /​usr/​local/​diskless/​FreeBSD/​dev
 +</​code>​
  
freebsd/pxe_boot.txt · Zuletzt geändert: 2013/12/16 14:40 von idefix