0% found this document useful (0 votes)
56 views53 pages

Xenserver: Unattended Installation

This document discusses unattended installation of XenServer using a file share or PXE boot. It covers starting unattended installation from CD or PXE, creating an answerfile, using a post-installation script, and sample configurations.

Uploaded by

dealahz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views53 pages

Xenserver: Unattended Installation

This document discusses unattended installation of XenServer using a file share or PXE boot. It covers starting unattended installation from CD or PXE, creating an answerfile, using a post-installation script, and sample configurations.

Uploaded by

dealahz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

XenServer

Unattended Installation

Christian Ferber
Systems Engineer Datacenter & Cloud

July 19th, 2013


Disclaimer

• This slide deck has been created as part of a project implementation


• It does not guarantee completeness of content
• The information provided here is no official Citrix support recommendation.
• Content can be used at own risk.

© 2012 Citrix
Why unattended installation?

• Avoid manual CD handling


• Create reproducable XenServer installations
• Datacenters sometimes have limited physical access
• Speed-up installation/upgrade process
• Desaster recovery
• ...or just to be a lazy administrator

© 2012 Citrix
Installation using file share
Installation using file share

• XenServer can retrieve installation files from


ᵒ CD
ᵒ NFS
ᵒ HTTP
ᵒ FTP
• Installation can be invoked by CD or PXE boot media
• File share installation typically is used for full unattended installation
• File share can be specified interactively during installation or by unattend file

© 2012 Citrix
Installation repository on file share

• Simple file share for hosting the installation files


• Access to share can be provided by FTP, HTTP or NFS
• Copy full CD content to 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

• Boot from CD and select network


installation source
• Select if DHCP or fixed IP should be used
for the installation process
ᵒ This does not configure IP settings for
XenServer after installation!
• Specify installation directory where
packages.x folders are stored
• Provide optional credentials

© 2012 Citrix
Unattended installation
Installation Types

• XenServer installation can be invoked by


ᵒ CD media
ᵒ PXE boot environment
• For both mentioned installation types an unattended installation can be used
complementary

© 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

• kernel parameter „answerfile=„ is used to specify unattend.xml file


• FTP/HTTP
ᵒ answerfile=http://<share + file>
ᵒ e.g. answerfile=http://192.168.0.1/xs60/xenserver01.xml
ᵒ Optionally include authentication credentials
• e.g. ftp://user:passwd@host...
• NFS
ᵒ answerfile=nfs://<server>:/<nfs path + file>
ᵒ e.g. answerfile=nfs://192.168.0.1:/xs60/xenserver01.xml

© 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?

• PXE Server = Proxy DHCP


• Architecture 1
ᵒ DHCP provides IP addresses and boot options
• Architecture 2
ᵒ DHCP provides IP addresses
ᵒ PXE / Proxy DHCP provides boot options
ᵒ Both services run on different servers
• Architecture 3
ᵒ DHCP provides IP addresses
ᵒ PXE / Proxy DHCP provides boot options
ᵒ Both services run on the same server

© 2012 Citrix
Standalone DHCP (Architecture 1)

• Configure DHCP server to provide IP addresses


• Add options to DHCP server
ᵒ 66 = TFTP server IP
ᵒ 67 = boot file name (pxelinux.0)
• Usually used
ᵒ when only 1 network based installation is available in datacenter
ᵒ full access to DHCP server is granted

© 2012 Citrix
DHCP + PXE on different hosts (Architecture 2)

• Configure DHCP server to provide IP addresses


• Configure PXE (Proxy DHCP) on different host to provide boot options
ᵒ next server
• TFTP server IP
ᵒ boot file
• pxelinux.0
• <path>/pxelinux.0 (in case pxelinux.0 is not in the root path of the tftp server)
• Usually used
ᵒ When DHCP server cannot be modified
ᵒ More PXE based installation technologies are available in the datacenter (PXE could
be separated by VLAN)

© 2012 Citrix
Setup TFTP server

• Use any available TFTP server


• Copy to TFTP root
ᵒ mboot.c32, menu.c32 & pxelinux.0 from <CD>/boot/pxelinux
• Create /xenserver dir in TFTP root
• Copy to /xenserver
ᵒ install.img from <CD>/
ᵒ vmlinuz & xen.gz from <CD>/boot
• Create /pxelinux.cfg dir in TFTP root
ᵒ Create default file in /pxelinux.cfg directory
• For details refer to installation guide
ᵒ http://support.citrix.com/article/CTX130421
© 2012 Citrix
Example „default“ file

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

• Download Serva (32bit/64bit)


ᵒ http://www.vercot.com/~serva/
• DHCP, ProxyDHCP and TFTP server for Windows (and much more)
• Example configuration for ProxyDHCP/PXE to use external DHCP for IP
addressing

© 2012 Citrix
Answerfile
About the answerfile

• Refer to installation guide


ᵒ http://support.citrix.com/article/CTX130421
ᵒ Installation guide does not document all options
• Answerfile is in XML format
ᵒ Options almost self-explaining
ᵒ Not anaconda-style
• Answerfile needs to be stored on http/ftp/nfs share

© 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

• Start task after successful installation


• Installation script has to be created in UNIX style
ᵒ For Windows use editors like
• http://notepad-plus.sourceforge.net/de/download.php
• http://www.grahl-software.com/en/ab-edit/
• http://www.brixoft.net/prodinfo.asp?id=1
• Script has to be stored
ᵒ On file share (nfs, http, ftp)
ᵒ Locally (file)
• Script is executed during installation, not after boot of server!!

© 2012 Citrix
Workflow with post script

XenServer XenServer
post-script.sh first-boot-script.sh
installation boot

• Copy first-boot-script.sh to local • Run XenServer configuration


disk commands (xe …)
• Enable start of first-boot-script.sh • Remove itself from autostart
after boot of XenServer

© 2012 Citrix
Post installation script - invoke post-script.sh

• Invoke post install script by


ᵒ <script stage="filesystem-populated" type="url">ftp://172.16.0.249/ftp/post-script.sh</script>

• 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

• Post installation script is invoked during installation, not after


boot of server
• During execution of script, XAPI is not running yet
• Post installation script is primarily used to
ᵒ copy script (which is run on first boot) to server
ᵒ Enable execution of copied script on first server boot
• Script example
#!/bin/sh
touch $1/tmp/post-executed
wget ftp://172.16.0.249/ftp/xenserver.scripts/first-boot-script-602-std.sh -O $1/tmp/first-boot-script.sh
chmod 777 $1/tmp/first-boot-script.sh
ln -s /tmp/first-boot-script.sh $1/etc/rc3.d/S99zzpostinstall

© 2012 Citrix
First boot script first-boot-script.sh

• Usually stored on file share


• Copy to server invoked by post install script (e.g. wget command)
• Includes all required configuration steps using xapi / xe commands or similar

#!/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

# Disable first boot script for subsequent reboots


rm -f /etc/rc3.d/S99zzpostinstall

# 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

• Driver required for installation


ᵒ usually storage driver
• Driver update required after installation
ᵒ all driver types
• Driver required for accessing network to get access to unattend.xml
ᵒ usually NIC driver

© 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

• Create driver repository


ᵒ extract content from iso file
ᵒ store it on installation source in sub directory (e.g. driver.<name>)
• Add line to unattend.xml
ᵒ point to driver sub dir on repository
ᵒ <driver-source type="url">ftp://172.16.0.249/ftp/xs60/driver.qlcnic</driver-source>

• 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

• Drivers will not be considered for installation itself


• Drivers will be installed on XenServer
• No need to add content to unattend.xml
• Unattended installation
ᵒ copy drivers to sub dir on repository (same step as shown on
previous slides)
ᵒ Add sub dir(s) to XS-REPOSITORY-LIST file in installation
root

© 2012 Citrix
Unattended installation of
updates
Unattended installation of updates

• Download updates from support.citrix.com


• Store .xsupdate files in sub folder of unattend install dir
• Update script tasks
ᵒ Copy updates to local server
ᵒ Execute update step by step
ᵒ Delete applied update
ᵒ Restart xapi or restart host depending on update type
ᵒ Re-invoke script after reboot
• See example script on next slide
• Include script section to update drivers as part of first boot script

© 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

for updatefile in `ls /tmp/updates`; do


sleep 60
echo "Uploading Update $updatefile ..."
echo "Uploading Update $updatefile ..." >> /var/log/messages
PATCHUUID=$(xe patch-upload file-name=/tmp/updates/$updatefile)
sleep 10
echo "Installing Update $updatefile ..."
echo "Installing Update $updatefile ...">> /var/log/messages
xe patch-apply host-uuid=$HOSTUUID uuid=$PATCHUUID
rm -f /tmp/updates/$updatefile
PATCHACTION=$(xe patch-list uuid=$PATCHUUID params=after-apply-guidance --minimal)
if [ "$PATCHACTION" == "restartXAPI" ]
then
/opt/xensource/bin/xe-toolstack-restart
sleep 60
elif [ "$PATCHACTION" == "restartHost" ]; then
reboot;
sleep 60
fi
done

# Disable first boot script for subsequent reboots


rm -f /etc/rc3.d/S99zzpostinstall
rm -f /tmp/secondboot

# Final Reboot
reboot

© 2012 Citrix
Additional information
Installation Debugging

• During installation: Move to TTY 2,3,4 (Strg + Alt + Fx)


• See e.g. DHCP messages
• Installation log file
/var/log/installer/install-log
• Tool for collecting all installer logs
/opt/xensource/installer/report.py

© 2012 Citrix
Undocumented answerfile
parameters
Installation / Mode

Element Description Required?

<installation> All nodes should be within a root node named installation. Y

Attributes:
You can specify an installation mode attribute with possible values fresh,
reinstall, upgrade, oemhdd and oemflash. For example:

<installation mode="fresh" >

If this attribute is not specified, the default is fresh.

© 2012 Citrix
Installation / Srtype

Element Description Required?

<installation> All nodes should be within a root node named installation. N

Attributes:
You can specify the type of your storage repository with the srtype attribute
with possible values lvm or ext. For example:

<installation mode="fresh" srtype="lvm">

If this attribute is not specified, the default is lvm.

© 2012 Citrix
Source

Element Description Required?

<source> Specifies where the packages should be installed from. Y


Attributes:
type: url, nfs, or local
If local, leave the element empty.
Example URLs:
http://[user[:passwd]]@host[:port]/path/
https://[user[:passwd]]@host[:port]/path/
ftp://[user[:passwd]]@host[:port]/path/
file:///path/
nfs://server:/path/

© 2012 Citrix
Network backend

Element Description Required?

<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?

<root-password> The desired root password for the XenServer host. N

If type is not specified, XenServer will ask for password after installation.

Possible values for type:


type=plaintext
type=hash

Example:
<root-password type="plaintext|hash">passwd</root-password>

Used password has to be extracted from /etc/passwd file from a running


system.

© 2012 Citrix
Nameserver

Element Description Required?

<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

Element Description Required?

<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

You might also like