Xenserver: Unattended Installation
Xenserver: Unattended Installation
Unattended Installation
Christian Ferber
Systems Engineer Datacenter & Cloud
© 2012 Citrix
Why unattended installation?
© 2012 Citrix
Installation using file share
Installation using file share
© 2012 Citrix
Installation repository on file share
© 2012 Citrix
Installation repository structure
• packages.main
ᵒ Base installation files
• packages.xenserver
ᵒ Repository information
• packages.transfer-vm
ᵒ Transfer-VM installation package
• Only for XenServer 6.0.2
ᵒ packages.XS…
• Full CD copy required to installation share (incl. XS-REPOSITORY-LIST)!!
© 2012 Citrix
Sample installation with file share source
© 2012 Citrix
Unattended installation
Installation Types
© 2012 Citrix
Starting unattended installation
by CD
Starting unattended installation by CD
• Boot XenServer CD
• Type menu.c32 in first prompt (be fast)
• Push „tab“ key
• Add line for unattended file and push
„enter“
ᵒ answerfile=ftp://172.16.0.249/ftp/unattend.xml
ᵒ install
© 2012 Citrix
Answerfile options
© 2012 Citrix
PXE based installation
PXE boot environment - requirements
• DHCP server
ᵒ provide IP addresses
ᵒ provide boot options like TFTP server and boot loader file name
• TFTP Server to provide boot loader
• PXE enabled server
© 2012 Citrix
DHCP vs PXE vs Proxy DHCP?
© 2012 Citrix
Standalone DHCP (Architecture 1)
© 2012 Citrix
DHCP + PXE on different hosts (Architecture 2)
© 2012 Citrix
Setup TFTP server
default xenserver
label xenserver
kernel mboot.c32
append xenserver/xen.gz dom0_max_vcpus=2 dom0_mem=752M com1=115200,8n1 console=com1,vga ---
xenserver/vmlinuz xencons=hvc console=hvc0 console=tty0 answerfile=ftp://172.16.0.249/ftp/unattend.xml
install --- xenserver/install.img
© 2012 Citrix
„default“ file with menu structure
default menu.c32
prompt 0
menu title PXE Boot Menu
label bootlocal
menu label Local Boot
menu default
localboot 0
timeout 100
label xs01
kernel mboot.c32
append xenserver/xen.gz dom0_max_vcpus=2 dom0_mem=752M com1=115200,8n1 console=com1,vga --- xenserver/vmlinuz xencons=hvc console=hvc0 console=tty0
answerfile_device=eth1 answerfile=nfs://10.10.11.100:/vol/vol_xs_inst/xs60/unattend.files/xs01.xml install --- xenserver/install.img
label xs02
kernel mboot.c32
append xenserver/xen.gz dom0_max_vcpus=2 dom0_mem=752M com1=115200,8n1 console=com1,vga --- xenserver/vmlinuz xencons=hvc console=hvc0 console=tty0
answerfile_device=eth1 answerfile=nfs://10.10.11.100:/vol/vol_xs_inst/xs60/unattend.files/xs02.xml install --- xenserver/install.img
label xs03
kernel mboot.c32
append xenserver/xen.gz dom0_max_vcpus=2 dom0_mem=752M com1=115200,8n1 console=com1,vga --- xenserver/vmlinuz xencons=hvc console=hvc0 console=tty0
answerfile_device=eth1 answerfile=nfs://10.10.11.100:/vol/vol_xs_inst/xs60/unattend.files/xs03.xml install --- xenserver/install.img
label xs04
kernel mboot.c32
append xenserver/xen.gz dom0_max_vcpus=2 dom0_mem=752M com1=115200,8n1 console=com1,vga --- xenserver/vmlinuz xencons=hvc console=hvc0 console=tty0
answerfile_device=eth1 answerfile=nfs://10.10.11.100:/vol/vol_xs_inst/xs60/unattend.files/xs04.xml install --- xenserver/install.img
© 2012 Citrix
Poor man‘s PXE server
© 2012 Citrix
Answerfile
About the answerfile
© 2012 Citrix
Sample answerfile (basic)
<?xml version="1.0"?>
<installation>
<keymap>de</keymap>
<primary-disk>sda</primary-disk>
<guest-disk>sda</guest-disk>
<root-password>citrix</root-password>
<source type="url">ftp://172.16.0.249/ftp/xs602</source>
<admin-interface name="eth0" proto="dhcp" />
<timezone>Europe/Berlin</timezone>
<hostname>autoinsttest</hostname>
<name-server>172.16.10.10</name-server>
<name-server>172.16.0.254</name-server>
</installation>
© 2012 Citrix
Sample answerfile (more comprehensive)
<?xml version="1.0"?>
<installation mode="fresh" srtype="lvm">
<bootloader>extlinux</bootloader>
<primary-disk gueststorage="yes">sda</primary-disk>
<keymap>de</keymap>
<hostname>xen01</hostname>
<root-password>citrix</root-password>
<source type="url">http://172.16.3.20/Xenserver/</source>
<admin-interface name="eth0" proto="static">
<ip>172.16.3.254</ip>
<subnet-mask>255.255.255.0</subnet-mask>
<gateway>172.16.3.1</gateway>
</admin-interface>
<name-server>172.16.3.1</name-server>
<name-server>172.16.3.10</name-server>
<timezone>Europe/Berlin</timezone>
<time-config-method>ntp</time-config-method>
<ntp-server>0.de.pool.ntp.org</ntp-server>
<ntp-server>1.de.pool.ntp.org</ntp-server>
<ntp-server>2.de.pool.ntp.org</ntp-server>
</installation>
© 2012 Citrix
Post installation script
Post installation script
© 2012 Citrix
Workflow with post script
XenServer XenServer
post-script.sh first-boot-script.sh
installation boot
© 2012 Citrix
Post installation script - invoke post-script.sh
• Stage options
ᵒ stage=“installation-start”
ᵒ stage=“file-system-populated”
• was “post-install-script” in earlier releases
• Invoked before installation has finished
• Root disk is still mounted
• Script will get parameter specifying root mount point (to be used with $1 in script)
ᵒ stage=“installation-complete”
• was “install-failed-script” in earlier releases
• Invoked after installation has finished
• Can run script conditionally e.g. when installation failed
• Root disk not mounted anymore
• Script will get parameter showing installation success (to be used with $1 in script)
- 0 = success
- not 0 = failure
© 2012 Citrix
Post installation script post-script.sh
© 2012 Citrix
First boot script first-boot-script.sh
#!/bin/bash
# Wait before start
sleep 60
# Assign License to server
HOSTNAME=$(hostname)echo $HOSTNAME
HOSTUUID=$(xe host-list name-label=$HOSTNAME --minimal)
xe host-apply-edition edition=platinum host-uuid=$HOSTUUID license-server-address=172.16.10.10 license-server-port=27000
# Final Reboot
reboot
© 2012 Citrix
Unattend file including post install script
<?xml version="1.0"?>
<installation>
<keymap>de</keymap>
<primary-disk>sda</primary-disk>
<guest-disk>sda</guest-disk>
<root-password>citrix</root-password>
<source type="url">ftp://172.16.0.249/ftp/xs60</source>
<script stage="filesystem-populated" type="url">ftp://172.16.0.249/ftp/xs60/postinstall.scripts/post-script.sh</script>
<admin-interface name="eth0" proto="dhcp" />
<timezone>Europe/Berlin</timezone>
<hostname>autoinsttest</hostname>
<name-server>172.16.10.10</name-server>
<name-server>172.16.0.254</name-server>
</installation>
© 2012 Citrix
Integrating Drivers
Driver types
© 2012 Citrix
Manual driver installation (compared to
unattended)
• Provided as zip download which includes
iso file
• Manual installation (2 methods)
ᵒ Select installation of supplemental disk and
attach iso/CD during installation
ᵒ install driver after XenServer installation by
running install.sh from iso file
• Optionally point to a file share where driver
is stored (requires extraction of iso file)
© 2012 Citrix
Driver required for installation
• Specified in unattend.xml
ᵒ driver will be used for installation
ᵒ driver will be installed on XenServer
ᵒ no need to install supplement separately or modify XS-REPOSITORY-LIST
© 2012 Citrix
Driver update after installation
© 2012 Citrix
Unattended installation of
updates
Unattended installation of updates
© 2012 Citrix
Example update script (first boot)
#!/bin/bash
# Install XenServer Updates
HOSTUUID=$(xe host-list name-label=$HOSTNAME --minimal)
cd /tmp
if [ -a /tmp/secondboot ]
then
echo "Secondboot"
else
mkdir updates
cd updates
echo "Downloading Updates..."
wget ftp://172.16.0.249/ftp/xs602/postinstall.updates/*.xsupdate
cd /tmp
touch /tmp/secondboot
fi
# Final Reboot
reboot
© 2012 Citrix
Additional information
Installation Debugging
© 2012 Citrix
Undocumented answerfile
parameters
Installation / Mode
Attributes:
You can specify an installation mode attribute with possible values fresh,
reinstall, upgrade, oemhdd and oemflash. For example:
© 2012 Citrix
Installation / Srtype
Attributes:
You can specify the type of your storage repository with the srtype attribute
with possible values lvm or ext. For example:
© 2012 Citrix
Source
© 2012 Citrix
Network backend
<network-backend> Attributes: N
You can specify the network-backend to be used. Values can be bridge or
openvswitch. Default uses the default of the XenServer version used for
installation.
Example:
<network-backend>openvswitch</network-backend>
© 2012 Citrix
Root-Password
Element Description Required?
If type is not specified, XenServer will ask for password after installation.
Example:
<root-password type="plaintext|hash">passwd</root-password>
© 2012 Citrix
Nameserver
<name-server> The IP address of a name-server. You should use one of these elements for N
each name-server you want to use.
© 2012 Citrix
NTP-Server
<ntp-server> The IP address or FQDN of a timeserver. You should use one of these N
elements for each time server you want to use.
© 2012 Citrix
Work better. Live better.
Backup
Answerfile parameters
Pre XenServer 6.0