Upload
kamil-czekirda
View
295
Download
3
Embed Size (px)
Citation preview
FreeBSD preseed installationKamil Czekirda [email protected]
AsiaBSDCon 20151
ABOUT ME
ftp.pl.freebsd.org ftp2.pl.freebsd.org
Work Studies
2
AGENDA
● Introduction● bsdinstall script extention● FAI - Fully Automatic Installer
as a distro● Netbooting FAI● Universal FAI● DEMO
3
INTRO
● Google Summer of Code 2014 project● provide a non interactive, unattended
FreeBSD installation process from the network
● without NFS server● extension for scripted bsdinstall● booting the FAI (Fully AutomaticInstaller) from the network by PXE
● based on mfsBSD● simple usage, without high barrier to
entry
4
bsdinstall script extention
● more parameters
● division installation into 3 parts:DEVICE PREPARATIONINSTALLATIONCONFIGURATION
5
DEVICE PREPARATION
● PARTITIONS="ada1 { auto freebsd-ufs /}"
● ZFSBOOT="YES"● ZFSBOOT_VDEV_TYPE="stripe"
stripe, mirror, raidz1, raidz2, raidz3● ZFSBOOT_DISKS=”ada0”● ZFSBOOT_POOL_NAME="zroot"● ZFSBOOT_SWAP_SIZE="2g"● ZFSBOOT_GELI_ENCRYPTION="YES"● ZFSBOOT_GELI_PW_PASSWORD="password"
6
INSTALLATION
● MIRROR="ftp://ftp.pl.freebsd.org/"● RELEASE="10.1”● DISTRIBUTIONS="kernel.txz base.txz"
We know “what” to install and “where”.
Configuration after reboot in installed system.
7
CONFIGURATION
● HOSTNAME="scriptedinstall"● KEYMAP="pl_PL.ISO8859-2"● DAEMONS="sshd dumpdev"● TIMEZONE="Europe/Warsaw"● ROOTPWHASH=’$6$salt$password’● ROOTPWPLAIN=”password”● USERSCONFIG=”/users/to/add”
adduser syntax● INTERFACE=”em0”● IPV4="YES"● DHCP="YES" if DHCP=”NO” then ADDRESSV4="192.168.1.254" NETMASK="255.255.255.0" GWV4="192.168.1.1"● IPV6● resolv.conf
8
SUMMARY9
DEVICE PREPARATION
INSTALLATION
REBOOT
CONFIGURATION
bsdinstall script conf.txt
FAI from mfsBSD
● mfsBSD on github:(https://github.com/mmatuska/mfsbsd)
● my SVN repo:https://svnweb.freebsd.
org/socsvn/soc2014/kczekirda/pxe-fai-head/tools/mfsbsd/● customs:
mfsbsd/conf/rc.local.sample/var in tmps
● create directory:mfsbsd/customfiles/etc/
● put configuration file into:mfsbsd/customfiles/etc/installerconfig
● make iso BASE=..../10.1-RELEASE/
10
DEMO
DEMO
11
LOCAL MIRROR+
DHCP SERVER
em0 10.11.12.1/24
em0
CLIENT1
em0
CLIENT2
em0
CLIENTn
LAN
● dhcp server
● tftp server
● http server
NETBOOTING FAI
CLIENTDHCP REQUEST
RESPONSE WITH TFTP INFO
SERVE EXECUTABLE
TFTP REQUEST
SERVE ISO and iPXE scripts
HTTP REQUEST
12
EXECUTABLE
● PXELINUXLABEL mfsBSD-faikernel memdiskappend initrd=/mfsBSD-FAI.iso iso raw
● iPXEkernel memdisk iso rawinitrd http://example.com/mfsBSD-FAI.isoboot
● iPXE without MEMDISKsanboot --drive 0x81 --no-describehttp://example.com/mfsBSD-FAI.iso
13
iPXE
● iPXE:http://ipxe.org
● iPXE features:boot from www server via HTTP and HTTPSboot from iSCSIboot from wireless network!control with a scriptvlan tagging
14
DHCP SERVER
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; next-server 192.168.1.1; if exists user-class and ( option user-class = "iPXE" ) { filename "http://example.com/mfsbsdfai.ipxe"; } else { filename "undionly.kpxe"; }}
15
mfsbsdfai.ipxe
#!ipxedhcpset iso http://example.com/mfsbsdfai.isosanboot --drive 0x81 --no-describe ${iso}
16
UNIVERSAL FAI
● one image for different configurations
● how to tell FAI where the configuration file is?
● add option bootfile-name"http://example.com/mfsbsdfai/";
● FAI tries to download file called the same as the MAC address, or default
17
DEMO
DEMO
18
LOCAL MIRROR+
DHCP SERVER + ROUTERem0
em1 10.11.12.1/24
em0
CLIENT1
em0
CLIENT2
em0
CLIENTn
LAN
Internet