vmbuilder kvm ubuntu -c vmbuilder.cfg –hostname=guest –ip=193.10.5.x –ssh-user-key=/home/user/user.key –dest=/home/user/kvm/guest –tmpfs=- –part=vmbuilder.partition
$ cat vmbuilder.cfg
[DEFAULT]
tmpfs=-
hostname = stark
ip = 193.10.5.x
gw = 193.10.5.1
dns = 130.242.80.14
part = vmbuilder.partition
user = user
name = user
pass = changeme
tmpfs = suid,dev,size=1G
timezone = Europe/Stockholm
firstboot = /home/user/boot.sh
;firstlogin = /home/user/login.sh
mem = 1024
cpus = 2
bridge = br0
[ubuntu]
mirror = http://se.archive.ubuntu.com/ubuntu/
proxy = http://host.domain.se:3142
suite = precise
flavour = virtual
addpkg = openssh-server, unattended-upgrades, acpid, denyhosts
[kvm]
libvirt = qemu:///system
$ cat vmbuilder.partition
root 21000
swap 1000
$ cat /home/user/boot.sh
# This script will run the first time the virtual machine boots
# It is ran as root.
# Expire the user account
passwd -e user
# Regenerate ssh keys
# rm /etc/ssh/ssh_host*key*
# dpkg-reconfigure -fnoninteractive -pcritical openssh-server
$ cat login.sh
# This script is ran the first time a user logs in
echo “This is a domain.se vm template server.”
echo “In order to do it, we’ll need to ask you a few questions,”
echo “starting by setting you keyboard and other console informations.”
# give the opportunity to change the keyboard
# sudo dpkg-reconfigure console-setup