There was a need to install FreeBSD on a laptop. Since the laptop is ancient, it does not support booting from a flash drive by usb. There were no blanks at hand either, it was decided to test the installation via PXE (Preboot eXecution Environment). Googling, I found several articles on this topic, but they describe installing linux from a linux server, or FreeBSD from a FreeBSD server. I do not pretend to create any particular method, just posting my instructions for quickly deploying FreeBSD 10.1 over the network.
The theoretical part of the PXE boot is well described in the article:
http://xgu.ru/wiki/PXESo let's get started. We will need: dhcp, tftp, nfs.
A server with Debian 7 installed will act as a server. I have already installed dnsmasq on it, which is both a dhcp and dns server. This is very convenient for a small home network, so as not to lift dhcp and bind separately. In addition, dnsmasq has its own tftp server, so it is ideally suited for our task, as they say - “all in one bottle”. It remains to install the nfs server and configure the whole thing. The PXE bootloader is available in the FreeBSD distribution image.
')
Install the necessary packages:
apt-get install dnsmasq nfs-kernel-server
We download FreeBSD iso-image from the official site freebsd.org. I used the minimum bootonly image:
wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/i386/ISO-IMAGES/10.1/FreeBSD-10.1-RELEASE-i386-bootonly.iso
Mount it:
mount -o loop FreeBSD-10.1-RELEASE-i386-bootonly.iso /mnt
Copy all image files to the directory that will be accessible via nfs:
cp -a /mnt /srv/nfs/freebsd
Add nfs-ball to / etc / exports
/srv/nfs/freebsd 192.168.0.0/24(rw,sync,no_subtree_check)
Restart nfs:
service nfs-kernel-server restart
Now it is necessary to correct something:Let's comment or delete the line in / srv / nfs / freebsd / etc / fstab so that the system does not try to mount the disk (the image is intended for writing to the disc) when booting, and mounted our nfs-ball as the root file system:
Remove the symbolic link /srv/nfs/freebsd/etc/resolv.conf, which refers to a nonexistent file /srv/nfs/freebsd/tmp/bsdinstall_etc/resolv.conf. In theory, the address of the dns server should have been obtained via dhcp and written to this file by the FreeBSD installer at startup. However, this does not happen: the installer creates an empty file, and if a file has already been created, overwrites it. Therefore, instead of a symlink, we create a new file /srv/nfs/freebsd/etc/resolv.conf and write the address of our dns server into it:
nameserver 192.168.0.101
We edit the /etc/dnsmasq.conf file, cite only those options that are required to solve our problem, i.e. dhcp + tftp without dns:
interface=eth0
Restart dnsmasq:
service dnsmasq restart
That's all. Go to the BIOS, select the boot order from the LAN (PXE). The network card loads pxe-loader, then the kernel is copied and started via tftp, the root file system is mounted via nfs, the FreeBSD installer is started, and then the standard FreeBSD installation. Do not forget only to complete the installation to change the boot order in the BIOS to the previous one.