Setting Up A PXE Install Server For FreeBSD With Debian
This tutorial shows how to set up a PXE install server with Debian for booting up FreeBSD sysinstall.
From Wikipedia:
The Preboot eXecution Environment (PXE, also known as Pre-Execution Environment, or 'pixie') is an environment to boot computers using a network interface independently of available data storage devices (like hard disks) or installed operating systems.
This is handy if your client computers don't have CD or floppy drives, or if you want to set up multiple computers at the same time (e.g. in a large enterprise). In this article I show how to configure a PXE server that allows you to boot FreeBSD.
1. Install required packages
# apt-get install dhcp3-server tftpd-hpa openbsd-inetd nfs-common nfs-kernel-server
2. Configure tftpd
Enable tftp
# vi /etc/default/tftpd-hpa
RUN_DAEMON="yes"
Set inetd to manage tftp connections. I will be serving the files from /srv/tftp. Edit /etc/indetd.conf and make sure tftp line is there, mine looks like
# vi /etc/indetd.conf
tftp dgram udp wait root /usrr/sbin/in.tftpd /usr/sbin/in.tftpd -s /srv/tftp
Save and restart inetd
# invoke-rc.d openbsd-inetd restart
3. Configure dhcp3
# vi /etc/dhcp3/dhcpd.conf
allow booting;
allow bootp;
default-lease-time 216000;
max-lease-time 432000;
authoritative;option domain-name "master-zone.net";
option domain-name-servers 192.168.0.3;subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.3;
option root-path "192.168.1.3:/srv/tftp";
filename "boot/pxeboot";
}
Save and restart dhcp
# invoke-rc.d dhcp3-server restart
4. Initialize boot directory
Fetch FreeBSD bootonly CD from the mirrors, mount the iso image, then copy the PXE boot folder to /srv/tftp
# wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/7.2/7.2-RELEASE-i386-bootonly.iso
# mount -t iso9660 7.2-RELEASE-i386-bootonly.iso /mnt/cd
# cp -r /mnt/cd/boot /srv/tftp
5. Configure NFS to export boot directory
This step is very important since FreeBSD uses NFS to fetch sysinstall files
# vi /etc/exports
/srv/tftp *(ro,sync,subtree_check,no_root_squash)
# exportfs -ra
6. Configure FreeBSD PXE boot files
# cd /srv/tftp/boot/
# echo 'vfs.root.mountfrom="ufs:/dev/md0c"' >> loader.conf
# gunzip -d mfsroot.gz
XML using PHP
This article helps those relatively new to using XML with PHP to write a short and uncomplicated XML file using the DOM in a PHP environment.
1. Create a new XML DOMDocument
$dom = new DomDocument('1.0', 'UTF-8');
Each XML document must have 1 and only 1 root element.
2. Create root node
$root = $dom->createElement('bookmarks');
$root = $dom->appendChild($root);
3. Create child node
$user = $dom->createElement('username', $userArray['Username']);
$root->appendChild($user);
4. Output XML
$xml_string = $dom->saveXML();
echo $xml_string;