The previous article solved the network problem before continuing:
Http://blog.csdn.net/sheismylife/article/details/8070072
See the wizard for this article: http://www.howtoforge.com/virtualization-with-kvm-on-ubuntu-12.04-lts
Enter the directory of the Virtual Machine file to be created:
CD/var/lib/libvirt/Images
Now I plan to create three virtual machines in the VM1, VM2, and vm3 directories. Let's take a look at how to create the first virtual machine.
Create the VM1 directory and Its subdirectories first
Mkdir-P/var/lib/libvirt/images/VM1/mytemplates/libvirt
Copy some vmbuilder files (lib1_xml_fsimage.tmpl lib1_xml. tmpl)
CP/etc/vmbuilder/libvirt/*/var/lib/libvirt/images/VM1/mytemplates/libvirt/
Create a file in the VM1 directory.Vmbuilder. Partition
The content is as follows:
root 24000swap 2000---/var 8000
--- Indicates that two partitions exist.
Root has 24 GB space, 2 GB space for swap, and 8 GB space for/var. 30 GB in total.
When starting a virtual machine system, you need to install the OpenSSH service so that external users can log on to it through SSH.
Run the following command to create the VM and the Ubuntu 12.04 amd64 server.
vmbuilder kvm ubuntu --suite=precise --flavour=virtual --arch=amd64 --mirror=http://de.archive.ubuntu.com/ubuntu -o --libvirt=qemu:///system --ip=10.112.18.191 --gw=10.112.18.1 --part=vmbuilder.partition --templates=mytemplates --user=chenshu --name=chenshu --pass=123456 --addpkg=openssh-server --addpkg=vim-nox --addpkg=unattended-upgrades --addpkg=acpid --mem=2048 --hostname=vm1 --bridge=br0
The memory size is 2 GB, the username is chenshu, and the initial password is 123456. For other parameters, see.
I tried the boot. Sh solution and failed. Use the -- addpkg parameter to specify the OpenSSH-Server installation.
Start to wait, and then succeed. :)