Chapter 13. Working with Templates
124
# cat etc/fstab
/dev/xvda / ext3 defaults 1 1
/dev/xvdb /mnt ext3 defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
7. Enable login via the console. The default console device in a XenServer system is xvc0. Ensure
that etc/inittab and etc/securetty have the following lines respectively:
# grep xvc0 etc/inittab
co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav
# grep xvc0 etc/securetty
xvc0
8. Ensure the ramdisk supports PV disk and PV network. Customize this for the kernel version you
have determined above.
# chroot /mnt/loop/centos54
# cd /boot/
# mv initrd-2.6.18-164.15.1.el5xen.img initrd-2.6.18-164.15.1.el5xen.img.bak
# mkinitrd -f /boot/initrd-2.6.18-164.15.1.el5xen.img --with=xennet --preload=xenblk --
omit-scsi-modules 2.6.18-164.15.1.el5xen
9. Change the password.
# passwd
Changing password for user root.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
10. Exit out of chroot.
# exit
11. Check etc/ssh/sshd_config for lines allowing ssh login using a password.
# egrep "PermitRootLogin|PasswordAuthentication" /mnt/loop/centos54/etc/ssh/sshd_config
PermitRootLogin yes
PasswordAuthentication yes
12. If you need the template to be enabled to reset passwords from the CloudPlatform UI or API,
install the password change script into the image at this point. See Section 13.13, “Adding
Password Management to Your Templates”.
13. Unmount and delete loopback mount.
# umount /mnt/loop/centos54
# losetup -d /dev/loop0
14. Copy the image file to your XenServer host's file-based storage repository. In the example below,
the Xenserver is "xenhost". This XenServer has an NFS repository whose uuid is a9c5b8c8-536b-
a193-a6dc-51af3e5ff799.