19
FreeBSD preseed installation Kamil Czekirda [email protected] AsiaBSDCon 2015 1

FreeBSD preseed installation (PXE) AsiaBSDCon 2015

Embed Size (px)

Citation preview

Page 1: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

FreeBSD preseed installationKamil Czekirda [email protected]

AsiaBSDCon 20151

Page 2: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

ABOUT ME

ftp.pl.freebsd.org ftp2.pl.freebsd.org

Work Studies

2

Page 3: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

AGENDA

● Introduction● bsdinstall script extention● FAI - Fully Automatic Installer

as a distro● Netbooting FAI● Universal FAI● DEMO

3

Page 4: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

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

Page 5: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

bsdinstall script extention

● more parameters

● division installation into 3 parts:DEVICE PREPARATIONINSTALLATIONCONFIGURATION

5

Page 6: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

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

Page 7: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

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

Page 8: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

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

Page 9: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

SUMMARY9

DEVICE PREPARATION

INSTALLATION

REBOOT

CONFIGURATION

bsdinstall script conf.txt

Page 10: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

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

Page 11: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

DEMO

DEMO

11

LOCAL MIRROR+

DHCP SERVER

em0 10.11.12.1/24

em0

CLIENT1

em0

CLIENT2

em0

CLIENTn

LAN

Page 12: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

● 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

Page 13: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

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

Page 14: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

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

Page 15: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

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

Page 16: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

mfsbsdfai.ipxe

#!ipxedhcpset iso http://example.com/mfsbsdfai.isosanboot --drive 0x81 --no-describe ${iso}

16

Page 17: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

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

Page 18: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

DEMO

DEMO

18

LOCAL MIRROR+

DHCP SERVER + ROUTERem0

em1 10.11.12.1/24

em0

CLIENT1

em0

CLIENT2

em0

CLIENTn

LAN

Internet

Page 19: FreeBSD preseed installation (PXE) AsiaBSDCon 2015

END

Thank you!

[email protected]

19