KeyWords:
SysAdmin,
Xen
xen-strap
Kudos to
Marian Klein for writing the
truly amazing
script
xen-strap
! It can bootstrap a Xen DomU based on
any of: Scientific Linux 4.x/5.x (also in the CERN variants),
CentOS
4.x/5.x, or Debian etch/lenny/sid. And all of this in
one single script
with no dependencies - just
download
and run. It hasn't been from the C64 times that I have seen a tool
requiring no configuration at all!
Last but not least, it install a truly
minimal system: no need to
have X11 or other fat daemons running on VMs...
Here is the incantation I used to build a template SL4.7 DomU:
/root/xen-strap --name=sl4-template \
--memory=1024 \
--size=8G \
--label=root \
--noswap \
--mac=00:16:3E:00:66:01 \
--dhcp \
--ssh \
--update \
--locales-en-only \
--dwc --no-ntp \
--post-install="host:/var/cfengine/scripts/newmachine" \
sl47 \
lvm:vg_root/sl4template:8G \
ftp://mirror.switch.ch/mirror/scientificlinux/47/i386/SL/RPMS/
A few words of explanation:
-
--name
is the name of the Xen configuration generated in /etc/xen
, and also the hostname (unless overridden with --hostname
)
-
--size
is the size of the partition/LV that xen-strap
will create for hosting the VM's root filesystem;
-
--label
is the label of the VM root filesystem (as seen from inside the VM);
-
--noswap
turns off creating a swap partition for the VM;
-
--mac
...= sets the MAC address (not in the mainstream xen-strap
, you need to apply the patch below)
-
--dhcp
will configure the DomU to use DHCP for networking;
-
--ssh
will install and enable the SSH server on the DomU;
-
--update
will start an OS update after everything has been installed;
-
--locales-en-only
will remove non-English locales, saving some space on the DomU disk;
-
--dwc --no-ntp
turns off the NTP daemon in the DomU (will use the clock in the Dom0, no worry);
-
--post-install="host:/path/to/script"
runs the post-install script found on the Dom0 at /path/to/script;
-
sl46
is the distribution to install (Scientific Linux 4.7, you need to apply the patch below - stock xen-strap
only has 4.6)
-
lvm:...
creates the specified LV to host the DomU root filesystem;
- the rest is the OS mirror URL - if you don't specify it, you get ==xen-strap=='s default choice (which is in the UK).
The long story and explanations can be found in the
GridPP Wiki:
http://www.gridpp.ac.uk/wiki/Xen-strap
Readers' comments