2010-10-31 21:30:10 +00:00
|
|
|
[[!meta title="Linux Virtual Machine Overview"]]
|
2010-10-31 21:04:10 +00:00
|
|
|
|
|
|
|
This document is ***WORK IN PROGRESS***
|
|
|
|
|
|
|
|
## Introduction
|
|
|
|
|
|
|
|
This article tries to summarise Linux Virtual Machine
|
2010-10-31 21:16:29 +00:00
|
|
|
methods and is in its early stage. It does not focus
|
|
|
|
on different types of hypervisors, but more on the
|
|
|
|
issues and features you get with each hypervisor.
|
|
|
|
|
|
|
|
### Host Kernel
|
|
|
|
|
|
|
|
Some supervisors need their own (modified Linux) kernel
|
|
|
|
to operate, whereas others work with any Linux kernel.
|
|
|
|
Though some of them again need some configurations
|
|
|
|
to be turned on in the stock kernel.
|
|
|
|
|
2010-10-31 21:59:17 +00:00
|
|
|
### VM Installation
|
|
|
|
|
|
|
|
Depending on the hypervisor, there are different requirements
|
|
|
|
and methods for the installation:
|
|
|
|
|
|
|
|
* Installation can be done within the VM for completly isolated machines
|
|
|
|
* Installation must be done outside / on the host for systems without own kernel
|
|
|
|
|
|
|
|
Some hypervisors can boot from the network, whereas others just
|
|
|
|
create a very lightweight isolation and boot an installed system
|
|
|
|
only.
|
|
|
|
|
|
|
|
### Guest OS changes
|
|
|
|
|
|
|
|
Some hypervisors require changes to the virtual machines, to be able
|
|
|
|
to run successfully. Others allow a original OS version to be
|
|
|
|
installed.
|
|
|
|
|
|
|
|
### Network configuration
|
|
|
|
|
|
|
|
Whether the VM is attached to a bridge, a tun/tap device, treated
|
|
|
|
as a normal process, there may be a lot of different configurations.
|
|
|
|
Furthermore, firewall (masquerade/nat) configurations may be necessary.
|
|
|
|
|
|
|
|
Additionally, some of the hypervisors support dynamic allocation
|
|
|
|
of mac or even ip addresses.
|
|
|
|
|
|
|
|
|
|
|
|
### Templates
|
|
|
|
|
|
|
|
Some hypervisors support reusage of installations.
|
|
|
|
|
2010-10-31 21:36:59 +00:00
|
|
|
### Management
|
|
|
|
|
|
|
|
Most hypervisors contain some minor collection of utilities
|
|
|
|
to manage virtual machines. Some libraries / frameworks
|
|
|
|
try to integrate those utilities, to abstract the different
|
|
|
|
implementations.
|
|
|
|
|
|
|
|
Typical issues are:
|
|
|
|
|
|
|
|
* Autostart machines on startup / autostop on shutdown
|
|
|
|
* Creation of new VMs / including template handling
|
|
|
|
* Manual start/stop of VMs
|
|
|
|
* Listing of running / existing VMs
|
|
|
|
|
2010-10-31 21:59:17 +00:00
|
|
|
### Automated usage
|
|
|
|
|
|
|
|
Especially interesting for a sysadmin is, how easy a system can
|
|
|
|
be automated, which steps need to be taken to get a new image
|
|
|
|
or copy of an existing one. This aspect is one focus of this
|
|
|
|
document.
|
|
|
|
|
2010-10-31 21:29:14 +00:00
|
|
|
## Hypervisors
|
2010-10-31 21:16:29 +00:00
|
|
|
|
|
|
|
[[!table data="""
|
2010-10-31 22:05:51 +00:00
|
|
|
Name | Host Kernel | Guest OS changes | Installation
|
|
|
|
[QEMU](http://wiki.qemu.org/) | Original | no | inside
|
|
|
|
[KVM](http://www.linux-kvm.org/) | Original w/KVM | no | inside
|
|
|
|
[Lguest](http://lguest.ozlabs.org/) | Original w/Lguest | ? | ?
|
|
|
|
[Linux Containers](http://lxc.sourceforge.net/) | Original w/Containers | yes | outside
|
|
|
|
[Linux VServer](http://linux-vserver.org) | Own | ? | ?
|
|
|
|
[User Mode Linux](http://user-mode-linux.sourceforge.net/) | Original | ? | outside
|
|
|
|
[OpenVZ](http://wiki.openvz.org/Main_Page) | Own | ? | ?
|
|
|
|
[Virtualbox](http://www.virtualbox.org/) | Original+Modules | no | inside
|
|
|
|
[VMWare](http://www.vmware.com/) | Original+Modules / Own | no | inside
|
|
|
|
[Xen](http://www.xen.org/) | Own | ? | ?
|
2010-10-31 21:16:29 +00:00
|
|
|
"""]]
|
|
|
|
|
2010-10-31 21:59:17 +00:00
|
|
|
### lxc
|
|
|
|
|
|
|
|
Some hints on lxc:
|
|
|
|
|
|
|
|
* Helper scripts existent (lxc-debian, lxc-fedora, ...)
|
|
|
|
* adjust init. change dev. do not run udev (why?)
|
|
|
|
* Root open in the filesystem
|
|
|
|
* No network specified = all from host accessible!
|
|
|
|
|
2010-10-31 22:28:30 +00:00
|
|
|
## Management Libraries / Frameworks
|
2010-10-31 21:04:10 +00:00
|
|
|
|
2010-10-31 21:29:14 +00:00
|
|
|
[[!table data="""
|
|
|
|
Name | Hints
|
|
|
|
Ganetti |
|
|
|
|
Libvirt |
|
|
|
|
"""]]
|
2010-10-31 21:04:10 +00:00
|
|
|
|
2010-10-31 22:28:30 +00:00
|
|
|
## Poor man's management
|
|
|
|
|
|
|
|
This sections describes typical vm management tasks, done with
|
|
|
|
easy commands.
|
|
|
|
|
|
|
|
### Creating a new (sparse) image file
|
|
|
|
|
|
|
|
dd if=/dev/zero of=<filename> bs=1 count=0 seek=<gigabytes>G
|
|
|
|
|
2010-10-31 21:04:10 +00:00
|
|
|
[[!tag net unix]]
|