installer configuration file
input parameters
Configuration file base on existing support for scripted installation bsdinstall(8) but have support for more parameters, like:
KEYMAP="pl_PL.ISO8859-2" HOSTNAME="testscriptinstall" MIRROR="ftp://ftp.pl.freebsd.org/" # RELDIR snapshots or releases RELDIR="snapshots" # 9.3-STABLE, 10.0-STABLE or 11.0-CURRENT when RELDIR="snapshots" # 9.1-RELEASE, 9.2-RELEASE, 9.3-RELEASE and 10.0-RELEASE when RELDIR="releases" RELEASE="11.0-CURRENT" TIMEZONE="Europe/Warsaw" # daemons to run on startup, if not set ssh will enable DAEMONS="sshd dumpdev" # name of your network interface (eg. bge0, sl0 etc) INTERFACE="em0" # default YES IPV4="YES" # default YES DHCP="YES" # if DHCP="NO" you can manually set IPV4 for interface $INTERFACE # ADDRESSV4="192.168.1.254" # NETMASK="255.255.255.0" # GWV4="192.168.1.1" # default NO # IPV6="NO" # autoconfiguration for IPV6 for interface $INTERFACE # SLAAC="YES" # if SLAAC="NO" you can manually set IPV6 for interface $INTERFACE # ADDRESSV6="2001:db8:4672:6565:2026:5043:2d42:5344/64" # GWV6="2001:db8:4672:6565::1" # manual resolver configuration: # DOMAIN="example.com" # DNS1="194.204.159.1" # DNS2="8.8.8.8" # DNS3="2001:4860:4860::8888" # DNS4="2001:4860:4860::8844" ######################## Needed manual configuration # hash of root password ROOTPWHASH='$6$Qb2inVrU65.r4Dx5$DaHdU2P1ipFMLZ8J5xJk8DDtC88rE87qo7du6CBvNgyit8RezQ2qkPe83X4KgTCTEtXGrMaMKZ1.W4xg1yz0z/' # root password in plaintext (not recommended) # ROOTPWPLAIN="password" # users in format from adduser -f tool adduser(8) # USERS="/etc/usersconfig" ######################## end manual configuration # if YES run preseed zfsboot installation ZFSBOOT="YES" ######################## ZFSPRESEED START # Virtual Device (vdev) type to create, possible options: # stripe - no redundancy, # mirror - n-Way Mirroring, # raidz1, raidz2, raidz3 - single, double, triple redundant RAID # ZFSBOOT_VDEV_TYPE="stripe" # disks to use # ZFSBOOT_DISKS="ada1" # ######################## Options behind are defaults. ######################## Don't touch if you don't need # Pool name # # ZFSBOOT_POOL_NAME="zroot" # Force 4K sectors? (YES or NO) # # ZFSBOOT_GNOP_4K_FORCE_ALIGN="YES" # Encrypt Disks? (YES or NO) # # ZFSBOOT_GELI_ENCRYPTION="" # Partition scheme (GPT or MBR) # # ZFSBOOT_PARTITION_SCHEME="GPT" # Swap size. Value passed to gpart(8); which supports SI unit suffixes. # # ZFSBOOT_SWAP_SIZE="2g" # Encrypt the swap? (YES or NO) # # ZFSBOOT_SWAP_ENCRYPTION="" # Mirror the swap? (YES or NO) # # ZFSBOOT_SWAP_MIRROR="NO" ######################## OTHERS # Options to use when creating zroot pool # # ZFSBOOT_POOL_CREATE_OPTIONS="-O compress=lz4 -O atime=off" # Name for the boot environment parent dataset # # ZFSBOOT_BEROOT_NAME="ROOT" # Name for the primany boot environment # # ZFSBOOT_BOOTFS_NAME="default" # ZFS datasets for root zpool # # ZFSBOOT_DATASETS=" # /$ZFSBOOT_BEROOT_NAME mountpoint=none # /$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME mountpoint=/ # /tmp mountpoint=/tmp,exec=on,setuid=off # /usr mountpoint=/usr,canmount=off # /usr/home # NB: /home is a symlink to /usr/home # /usr/ports setuid=off # /usr/src # /var mountpoint=/var # /var/crash exec=off,setuid=off # /var/log exec=off,setuid=off # /var/mail atime=on # /var/tmp setuid=off #" # Path to the geli(8) keyfile used in drive encryption # # ZFSBOOT_GELI_KEY_FILE="/boot/encryption.key" # Create a separate boot pool? (YES or NO) # NB: Automatically set when using geli(8) or MBR # # ZFSBOOT_BOOT_POOL="" # Options to use when creating separate boot pool (if any) # # ZFSBOOT_BOOT_POOL_CREATE_OPTIONS="" # Default name for boot pool when enabled (e.g., geli(8) or MBR) # # ZFSBOOT_BOOT_POOL_NAME="bootpool" # Passphrase used to protect encryption keys !! SENSITIVE INFO !! # # ZFSBOOT_GELI_PW_PASSWORD="" # If interactive and the user has not explicitly chosen a vdev type or disks, # make the user confirm scripted/default choices when proceeding to install. # ZFSBOOT_CONFIRM_LAYOUT="" ZFSBOOT_PRESEED_CONFIRM="YES" ######################## END ZFSPRESEED
BE CAREFUL in PARTITIONS parameter and ZFSBOOT_DISKS - BSDINSTALL WILL ERASE YOUR HARD DISK!!!
Application 1 - scripted installation
after preparing your configuration files just run: bsdinstall script /path/to/configuration/file
Application 2 - special distro - installer
You can create your personalized installation distro yourselve. You can create iso file and record it on cd or create img to write on USB stick.
Copy mfsbsd from my svn: http://svnweb.freebsd.org/socsvn/soc2014/kczekirda/pxe-fai-head/tools/mfsbsd/
There are some custom files, put your templates to: mfsbsd/customfiles/etc/ or reedit existed.
To build installation media just do: make iso BASE=/path/to/builded/ftp/files for iso file or make BASE=/path/to/builded/ftp/files for USB stick image file
You can record created iso file or write created img file to USB stick and boot computer from your media. When mfsbsd booted bsdinstall starts automatically and do installation.
Application 3 - boot mfsbsd from network
You don't need to write created in step 2 files on media. You can boot mfsbsd from network by PXE protocol.
You need build iPXE file and chainload it from TFTP server using option "file" in dhcp server.
simple code to embed in iPXE:
#!ipxe dhcp set iso http://example.com/path/to/your/image/file/mfsbsd.iso kernel http://example.com/path/to/memdisk/file/memdisk iso raw initrd ${iso} boot
After boot from PXE your DHCP server should export file option with path to undionly.kpxe, then chainload iPXE with script which use memdisk as kernel and created img file as initrd.
You can prepare a few images and run different machines from different media.
Application 4 - boot mfsbsd from network - preseed installation - the culmination of project
You can to build only one image and only settings to installer can be different for different hosts.
Put modified template file to your http or ftp server and run Fully Automatic Installer. How to tell fai where is configuration file? Use bootfile-name option in your dhcpd server. Fai will try to download file called the same as MAC address from their network interface, next default file and when find it runs scripted installer.
DHCP Server configuration:
subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.10 192.168.1.20; option routers 192.168.1.1; option bootfile-name "http://example.com/mfsbsdfai/"; if exists user-class and ( option user-class = "iPXE" ) { filename "http://example.com/mfsbsdfai.ipxe"; } else { filename "undionly.kpxe"; } }
mfsbsdfai.ipxe is exactly the same as in scenario 3
www server:
kczekirda@www:/var/www/mfsbsdfai$ ls -la -rw-r--r-- 1 czyki wheel 636 sie 21 23:42 08:00:27:59:ca:39 -rw-r--r-- 1 czyki wheel 636 sie 20 21:17 default
Comments and tests for more scenarios are welcome.
Please contact me if you need assistance, not everything may be clear on this wiki page.