Xencreate

On Dom0
Mod xencreate_* script in /root/ on the dom0

edit xencreate script vi /root/xencreate_InstanceName Where: Edit: sudo xen-create-image \ --hostname=hostname \ --memory=ram_sizeMb \ --mac=xx:xx:xx:xx:x:x \ --ip=yyy.yyy.yyy.yyy \ --netmask=255.255.255.192 \ --gateway=140.211.169.129 \ --dist=lucid \ --install-method=debootstrap \ --mirror=http://archive.ubuntu.com/ubuntu \ --arch=amd64 \ --image-dev=/dev/VgName/instance-root \ --swap-dev=/dev/VgName/instance-swap \ --fs=ext3 \ --passwd \
 * InstanceName is the *new* instance name

Where:
 * hostname is the instance hostname
 * ram_size is the amount of RAM allocated to the instance
 * xx:xx:xx:xx:xx:xx is the mac address of the outside network
 * yyy IP of eth0
 * instance is the lv name of the instance
 * VgName is the VolumeGroupName for the volume the instance LVs live in.

make xencreate_instance executable chmod +x xencreate_instance Where
 * instance is the new instance name

create the new instance ./xencreate_instance Where: (Type in root password when prompted)
 * instance is the new instance name

Mod xen config script(/etc/xen/instance_name) vi /etc/xen/instance_name Where: Add: bootloader = '/usr/bin/pygrub' memory ='xxxx' maxmem ='yyyy' vcpu ='Z'
 * instance-root is the LvName-root of the instance

Where:
 * xxxx is the starting memory in M
 * yyyy is the Maximum memory for the instance
 * Z is the number of vcpus assigned to the instance

(remove any "kernel =" & "ramdisk ="lines)
 * This allows us to control kernels from within the instance

Add: , 'mac=yy:yy:yy:yy:yy:yy,ip=10.10.10.xxx,bridge=eth1'

Where:
 * yy:yy:yy:yy:yy:yy is inside mac address
 * xxx is inside IP address

To Line: vif = [ 'mac=ff:ff:ff:ff:ff:ff,ip=140.211.169.ZZZ,bridge=eth0' ] Forming: vif = [ 'mac=ff:ff:ff:ff:ff:ff,ip=140.211.169.ZZZ,bridge=eth0', 'mac=yy:yy:yy:yy:yy:yy,ip=10.10.10.x,bridge=eth1' ]

Add: extra='xencons=hvc0'

to the bottom of the file

create SWAP mkswap /dev/vg_name/LvName-swap

Setup chroot create mountpoint for chroot mkdir /mnt/instance-root Where:
 * instance-root is the LvName-root of the instance

Mount instance rootfs mount -t ext3 /dev/VgName/instance-root /mnt/instance-root Where:
 * VgName is the VolumeGroupName where the instance-root lives
 * instance-root is the LvName-root of the instance

Bind mount /mnt/instance-root/{dev,sys,proc} mount -o bind /dev /mnt/instance-root/dev mount -o bind /sys /mnt/instance-root/sys mount -o bind /proc /mnt/instance-root/proc Where:
 * instance-root is the LvName-root of the instance

Chroot into /mnt/instance-root chroot /mnt/instance-root Where:
 * instance-root is the LvName-root of the instance

Inside chroot
Install latest (or approved) linux-image-server on chroot apt-get update apt-get upgrade apt-get install linux-image-server

Install and configure grub apt-get install grub cd /boot/grub update-grub Update-grub should create a /boot/grub/menu.lst

Minimally configure /etc/hosts in the rootfs by mounting and editing. vi /etc/hosts Add: 127.0.0.1 localhost 140.211.169.XXX hostname fQDN Where:
 * XXX is last octet of outside IP address.
 * hostname is the shortname of the instance (eg.bozo)
 * FQDN is Fully Qualified Domain Name (eg. bozo.clown.org)

Add hvc0 to the list of console ports cd /etc/init cp tty1.conf hvc0.conf vi hvc0.conf Exit from the chroot exit
 * change tty1 in the exec /sbin/getty line

On dom0
unmount bind mounts and /mnt/instance-root

umount /mnt/instance-root/dev umount /mnt/instance-root/sys umount /mnt/instance-root/proc umount /mnt/instance-root Where:
 * instance-root is the LvName-root for the rootfs of the VM