Difference between revisions of "KVM Virtualization"
(Created page with 'vmbuilder kvm ubuntu --suite=karmic --flavour=virtual --arch=i386 --mirror=http://192.168.122.1:9999/ubuntu -o --libvirt=qemu:///system --tmpfs=- --ip=192.168.122.2 --part=vmbuil...') |
|||
Line 1: | Line 1: | ||
− | + | ==KVM Virtualization== | |
− | http://doc.ubuntu.com/ubuntu/serverguide/C/libvirt.html | + | ====Example vmbuilder Commands==== |
− | http://doc.ubuntu.com/ubuntu/serverguide/C/jeos-and-vmbuilder.html | + | The following vmbuilder example will configure a 32bit test VM with 256mb of ram, set up partitions, set up the VM's hostname, set a static IP that's on the virtual bridge for NAT purposes, set up a default user and password, install the 'unattended-upgrades' and 'acpid' packages by default, and run first-boot commands as specified in the filename listed. |
− | http://www.howtoforge.com/virtualization-with-kvm-on-ubuntu-9.04 | + | |
− | https://help.ubuntu.com/community/JeOSVMBuilder | + | The templates used for the VM are stored in the directory the VM is housed in, and can be named whatever, you just need to change the --templates= line to reflect the actual directory. |
− | http://wiki.libvirt.org/page/Networking | + | |
+ | The vmbuilder.partition and boot.sh files will need to be built and tailored to each VM, or if all of the VMs will use the same settings, you can always just make copies or symlink. | ||
+ | |||
+ | =====vmbuilder with NAT addressing===== | ||
+ | <pre> | ||
+ | vmbuilder kvm ubuntu --suite=karmic --flavour=virtual --arch=i386 --mirror=http://192.168.122.1:9999/ubuntu -o --libvirt=qemu:///system \ | ||
+ | --tmpfs=- --ip=192.168.122.2 --part=vmbuilder.partition --templates=templates --user=superuser --name=Administrator --pass=Phaeyu3u \ | ||
+ | --addpkg=unattended-upgrades --addpkg=acpid --firstboot=boot.sh --mem=256 --hostname=testvm1 | ||
+ | </pre> | ||
+ | |||
+ | =====vmbuilder with bridged public access===== | ||
+ | <pre> | ||
+ | vmbuilder kvm ubuntu --suite=karmic --flavour=virtual --arch=i386 --mirror=http://134.50.87.179:9999/ubuntu -o --libvirt=qemu:///system \ | ||
+ | --tmpfs=- --ip=134.50.87.180 --part=vmbuilder.partition --templates=templates --user=superuser --name=Administrator --pass=Phaeyu3u \ | ||
+ | --addpkg=unattended-upgrades --addpkg=acpid --addpkg=htop --firstboot=boot.sh --mem=1024 --hostname=testvm1 --bridge=br0 --cpus=1 | ||
+ | </pre> | ||
+ | |||
+ | =====vmbuilder.partition===== | ||
+ | <pre> | ||
+ | root 10000 | ||
+ | swap 4000 | ||
+ | </pre> | ||
+ | |||
+ | This sets up a 10GB root and a 4GB swap partition for the VM. | ||
+ | |||
+ | =====boot.sh===== | ||
+ | <pre> | ||
+ | passwd -e superuser | ||
+ | apt-get update | ||
+ | apt-get install -qqy --force-yes openssh-server | ||
+ | </pre> | ||
+ | |||
+ | 'passwd -e' expires the user's password, requiring it be changed on first login. | ||
+ | |||
+ | ===External Links=== | ||
+ | * http://doc.ubuntu.com/ubuntu/serverguide/C/libvirt.html | ||
+ | * http://doc.ubuntu.com/ubuntu/serverguide/C/jeos-and-vmbuilder.html | ||
+ | * http://www.howtoforge.com/virtualization-with-kvm-on-ubuntu-9.04 | ||
+ | * https://help.ubuntu.com/community/JeOSVMBuilder | ||
+ | * http://wiki.libvirt.org/page/Networking | ||
+ | * https://bugs.launchpad.net/ubuntu/+source/vm-builder/+bug/313575 |
Latest revision as of 23:02, 16 December 2009
KVM Virtualization
Example vmbuilder Commands
The following vmbuilder example will configure a 32bit test VM with 256mb of ram, set up partitions, set up the VM's hostname, set a static IP that's on the virtual bridge for NAT purposes, set up a default user and password, install the 'unattended-upgrades' and 'acpid' packages by default, and run first-boot commands as specified in the filename listed.
The templates used for the VM are stored in the directory the VM is housed in, and can be named whatever, you just need to change the --templates= line to reflect the actual directory.
The vmbuilder.partition and boot.sh files will need to be built and tailored to each VM, or if all of the VMs will use the same settings, you can always just make copies or symlink.
vmbuilder with NAT addressing
vmbuilder kvm ubuntu --suite=karmic --flavour=virtual --arch=i386 --mirror=http://192.168.122.1:9999/ubuntu -o --libvirt=qemu:///system \ --tmpfs=- --ip=192.168.122.2 --part=vmbuilder.partition --templates=templates --user=superuser --name=Administrator --pass=Phaeyu3u \ --addpkg=unattended-upgrades --addpkg=acpid --firstboot=boot.sh --mem=256 --hostname=testvm1
vmbuilder with bridged public access
vmbuilder kvm ubuntu --suite=karmic --flavour=virtual --arch=i386 --mirror=http://134.50.87.179:9999/ubuntu -o --libvirt=qemu:///system \ --tmpfs=- --ip=134.50.87.180 --part=vmbuilder.partition --templates=templates --user=superuser --name=Administrator --pass=Phaeyu3u \ --addpkg=unattended-upgrades --addpkg=acpid --addpkg=htop --firstboot=boot.sh --mem=1024 --hostname=testvm1 --bridge=br0 --cpus=1
vmbuilder.partition
root 10000 swap 4000
This sets up a 10GB root and a 4GB swap partition for the VM.
boot.sh
passwd -e superuser apt-get update apt-get install -qqy --force-yes openssh-server
'passwd -e' expires the user's password, requiring it be changed on first login.
External Links
- http://doc.ubuntu.com/ubuntu/serverguide/C/libvirt.html
- http://doc.ubuntu.com/ubuntu/serverguide/C/jeos-and-vmbuilder.html
- http://www.howtoforge.com/virtualization-with-kvm-on-ubuntu-9.04
- https://help.ubuntu.com/community/JeOSVMBuilder
- http://wiki.libvirt.org/page/Networking
- https://bugs.launchpad.net/ubuntu/+source/vm-builder/+bug/313575