Installing FreeBSD with netboot
|  (added the nfs part to make it more complete..) | m (Reverted edits by 178.239.58.143 (talk) to last revision by 70.89.87.138) | ||
| (13 intermediate revisions by 8 users not shown) | |||
| Line 3: | Line 3: | ||
| Download the bootonly-iso: | Download the bootonly-iso: | ||
| − |   fetch ftp://ftp.freebsd.org/pub/FreeBSD/ | + |   fetch ftp://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-i386/8.2/FreeBSD-8.2-RELEASE-i386-bootonly.iso | 
| + |  fetch ftp://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-amd64/8.2/FreeBSD-8.2-RELEASE-amd64-bootonly.iso | ||
| Mount the iso-image and copy the contents to some location: | Mount the iso-image and copy the contents to some location: | ||
| − |   mdconfig -a -t vnode -f  | + |   mdconfig -a -t vnode -f FreeBSD-8.2-RELEASE-i386-bootonly.iso | 
| − |   mount_cd9660 /dev/md0 /mnt | + |   mount_cd9660 /dev/md0 /mnt | 
|   mkdir /usr/local/pxeboot |   mkdir /usr/local/pxeboot | ||
| − |   cp - | + |   cp -R /mnt/ /usr/local/pxeboot | 
| − |   umount /mnt | + |   umount /mnt | 
| + |  mdconfig -d -u 0 | ||
| The main reason for copying the cd is to edit the file /boot/loader.conf adding the following line: | The main reason for copying the cd is to edit the file /boot/loader.conf adding the following line: | ||
| − |   echo 'vfs.root.mountfrom="ufs:/dev/ | + |   echo 'vfs.root.mountfrom="ufs:/dev/md0"' >> /usr/local/pxeboot/boot/loader.conf | 
| This will cause the lovable FreeBSD sysinstall to start. The pxeboot will mount the rootfs from the file mfsroot.gz instead of the default of mounting a NFS-root. | This will cause the lovable FreeBSD sysinstall to start. The pxeboot will mount the rootfs from the file mfsroot.gz instead of the default of mounting a NFS-root. | ||
| Line 36: | Line 38: | ||
| Now it's time for the DHCP-server that the firmware will query to get address and path to the network bootstrap program. | Now it's time for the DHCP-server that the firmware will query to get address and path to the network bootstrap program. | ||
| − | Install isc- | + | Install isc-dhcp31-server | 
| − |   pkg_add -r isc- | + |   pkg_add -r isc-dhcp31-server | 
| Edit /usr/local/etc/dhcpd.conf adding the following lines. | Edit /usr/local/etc/dhcpd.conf adding the following lines. | ||
| + |  ddns-update-style none; | ||
|   server-name "pxe-gw";          # name of the tftp-server |   server-name "pxe-gw";          # name of the tftp-server | ||
|   server-identifier 172.24.0.4;  # address of the tftp-server |   server-identifier 172.24.0.4;  # address of the tftp-server | ||
| Line 50: | Line 53: | ||
|       filename "pxeboot";                    # filename of NBP (network bootstrap program) |       filename "pxeboot";                    # filename of NBP (network bootstrap program) | ||
|   } |   } | ||
| − | |||
| == NFS == | == NFS == | ||
Latest revision as of 17:18, 4 January 2012
| Contents | 
[edit] FreeBSD bootonly
The first step to installing FreeBSD via netboot is to acquire FreeBSD. We'll be using the bootonly-iso, this can be fetched at your nearest ftp.
Download the bootonly-iso:
fetch ftp://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-i386/8.2/FreeBSD-8.2-RELEASE-i386-bootonly.iso fetch ftp://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-amd64/8.2/FreeBSD-8.2-RELEASE-amd64-bootonly.iso
Mount the iso-image and copy the contents to some location:
mdconfig -a -t vnode -f FreeBSD-8.2-RELEASE-i386-bootonly.iso mount_cd9660 /dev/md0 /mnt mkdir /usr/local/pxeboot cp -R /mnt/ /usr/local/pxeboot umount /mnt mdconfig -d -u 0
The main reason for copying the cd is to edit the file /boot/loader.conf adding the following line:
echo 'vfs.root.mountfrom="ufs:/dev/md0"' >> /usr/local/pxeboot/boot/loader.conf
This will cause the lovable FreeBSD sysinstall to start. The pxeboot will mount the rootfs from the file mfsroot.gz instead of the default of mounting a NFS-root.
[edit] NIC with PXE boot
For the pxeboot to work you might have to update your NIC with new firmware. See your manufacturer homepage for more information.
[edit] TFTP
Next up is starting a tftp-server from which the firmware can load the network bootstrap program from. This is easiest done by using inetd, remove the leading # from the following line in the file /etc/inetd.conf.
#tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /tftpboot
Make the tftpboot directory and copy the boot/pxeboot file to it.
mkdir /tftpboot cp /usr/local/pxeboot/boot/pxeboot /tftpboot/
Then start inetd by adding it to rc.conf and starting it.
echo 'inetd_enable="YES"' >> /etc/rc.conf /etc/rc.d/inetd start
It can be a good idea to start a tail of messages and xferlog file to see what is happening. In another terminal run:
tail -f /var/log/messages /var/log/xferlog
[edit] DHCP
Now it's time for the DHCP-server that the firmware will query to get address and path to the network bootstrap program.
Install isc-dhcp31-server
pkg_add -r isc-dhcp31-server
Edit /usr/local/etc/dhcpd.conf adding the following lines.
ddns-update-style none; server-name "pxe-gw"; # name of the tftp-server server-identifier 172.24.0.4; # address of the tftp-server next-server 172.24.0.4; # address of the NFS-server
subnet 172.24.0.0 netmask 255.255.255.0 {
    range 172.24.0.137 172.24.0.253;
    option routers 172.24.0.1;
    option root-path "/usr/local/pxeboot"; # root-path for NFS
    filename "pxeboot";                    # filename of NBP (network bootstrap program)
}
[edit] NFS
Add the pxeboot directory to nfs exports file
echo '/usr/local/pxeboot -alldirs -maproot=root -ro' >> /etc/exports
Enable NFS in rc.conf
echo 'nfs_server_enable="YES"' >> /etc/rc.conf
Start nfsd
/etc/rc.d/nfsd start
Reboot your computer and select PXE-boot you should now enter sysinstall, have a nice day!
