A
LibVirt é uma biblioteca muito utilizada por quem faz virtualização para conversar com os diversos tipos de
hypervisor (Google diz que em português seria
hipervisor, mas vou manter o uso do y). Se nunca ouviu falar dela, não se preocupe! Alguns utilitários, criados com essa biblioteca, são o
virsh, virt-install e
virt-manager que configuram e permitem a ativação de uma máquina virtual completa.
O vídeo do Youtube
Instalando Linux usando o Virt-Manager mostra como se faz para instalar duas máquinas, cada uma contendo um Linux diferente sendo que as versões instaladas são: Debian 8 e CentOS 7. O
hypervisor usado por padrão, no
vídeo, é o kvm. Entretanto, o
vídeo não comentou quais pacotes precisam ser instalados.
No Ubuntu Desktop 16.04 LTS, basta executar:
rlucca@millie:~$ sudo apt install -y virtinst_
O pacote
virtinst deve fazer com que todas as dependencias necessarias sejam instaladas, alem disso a opção '-y' deve fazer com que em qualquer pergunta de confirmação a opção 'yes' (sim) seja escolhida automaticamente. Sendo assim, o comando
virt-install,
virt-manager e
virsh estão instalados. O
virt-install é mostrado a seguir.
rlucca@millie:~$ virt-install --version
1.3.2
rlucca@millie:~$ virt-install --help
usage: virt-install --name NAME --ram RAM STORAGE INSTALL [opti
Create a new virtual machine from specified install media.
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--connect URI Connect to hypervisor with libvirt URI
General Options:
-n NAME, --name NAME Name of the guest instance
--memory MEMORY Configure guest memory allocation. Ex:
--memory 1024 (in MiB)
--memory 512,maxmemory=1024
--vcpus VCPUS Number of vcpus to configure for your g
--vcpus 5
--vcpus 5,maxcpus=10,cpuset=1-4,6,8
--vcpus sockets=2,cores=4,threads=2,
--cpu CPU CPU model and features. Ex:
--cpu coreduo,+x2apic
--cpu host
--metadata METADATA Configure guest metadata. Ex:
--metadata name=foo,title="My pretty ti
--metadata description="My nice long de
Installation Method Options:
--cdrom CDROM CD-ROM installation media
-l LOCATION, --location LOCATION
Installation source (eg, nfs:host:/path,
http://host/path, ftp://host/path)
--pxe Boot from the network using the PXE pro
--import Build guest around an existing disk ima
--livecd Treat the CD-ROM media as a Live CD
-x EXTRA_ARGS, --extra-args EXTRA_ARGS
Additional arguments to pass to the ins
booted from --location
--initrd-inject INITRD_INJECT
Add given file to root of initrd from -
--os-variant DISTRO_VARIANT
The OS variant being installed guests,
'fedora18', 'rhel6', 'winxp', etc.
--boot BOOT Configure guest boot settings. Ex:
--boot hd,cdrom,menu=on
--boot init=/sbin/init (for containers)
--idmap IDMAP Enable user namespace for LXC container
--idmap uid_start=0,uid_target=1000,uid
Device Options:
--disk DISK Specify storage with various options. E
--disk size=10 (new 10GiB image in defa
--disk /my/existing/disk,cache=none
--disk device=cdrom,bus=scsi
--disk=?
-w NETWORK, --network NETWORK
Configure a guest network interface. Ex
--network bridge=mybr0
--network network=my_libvirt_virtual_ne
--network network=mynet,model=virtio,ma
--network none
--network help
--graphics GRAPHICS Configure guest display settings. Ex:
--graphics vnc
--graphics spice,port=5901,tlsport=5902
--graphics none
--graphics vnc,password=foobar,port=591
--controller CONTROLLER
Configure a guest controller device. Ex
--controller type=usb,model=ich9-ehci1
--input INPUT Configure a guest input device. Ex:
--input tablet
--input keyboard,bus=usb
--serial SERIAL Configure a guest serial device
--parallel PARALLEL Configure a guest parallel device
--channel CHANNEL Configure a guest communication channel
--console CONSOLE Configure a text console connection bet
and host
--hostdev HOSTDEV Configure physical USB/PCI/etc host dev
shared with the guest
--filesystem FILESYSTEM
Pass host directory to the guest. Ex:
--filesystem /my/source/dir,/dir/in/gue
--filesystem template_name,/,type=templ
--sound [SOUND] Configure guest sound device emulation
--watchdog WATCHDOG Configure a guest watchdog device
--video VIDEO Configure guest video hardware.
--smartcard SMARTCARD
Configure a guest smartcard device. Ex:
--smartcard mode=passthrough
--redirdev REDIRDEV Configure a guest redirection device. E
--redirdev usb,type=tcp,server=192.168.
--memballoon MEMBALLOON
Configure a guest memballoon device. Ex
--memballoon model=virtio
--tpm TPM Configure a guest TPM device. Ex:
--tpm /dev/tpm
--rng RNG Configure a guest RNG device. Ex:
--rng /dev/random
--panic PANIC Configure a guest panic device. Ex:
--panic default
Guest Configuration Options:
--security SECURITY Set domain security driver configuratio
--numatune NUMATUNE Tune NUMA policy for the domain process
--memtune MEMTUNE Tune memory policy for the domain proce
--blkiotune BLKIOTUNE
Tune blkio policy for the domain proces
--memorybacking MEMORYBACKING
Set memory backing policy for the domai
--memorybacking hugepages=on
--features FEATURES Set domain XML. Ex:
--features acpi=off
--features apic=on,eoi=on
--clock CLOCK Set domain XML. Ex:
--clock offset=localtime,rtc_tickpolicy
--pm PM Configure VM power management features
--events EVENTS Configure VM lifecycle management polic
--resource RESOURCE Configure VM resource partitioning (cgr
Virtualization Platform Options:
-v, --hvm This guest should be a fully virtualize
-p, --paravirt This guest should be a paravirtualized
--container This guest should be a container guest
--virt-type HV_TYPE Hypervisor name to use (kvm, qemu, xen,
--arch ARCH The CPU architecture to simulate
--machine MACHINE The machine type to emulate
Miscellaneous Options:
--autostart Have domain autostart on host boot up.
--wait WAIT Minutes to wait for install to complete
--noautoconsole Don't automatically try to connect to t
console
--noreboot Don't boot guest after completing insta
--print-xml [XMLONLY]
Print the generated domain XML rather t
guest.
--dry-run Run through install process, but do not
or define the guest.
--check CHECK Enable or disable validation checks. Ex
--check path_in_use=off
--check all=off
-q, --quiet Suppress non-error output
-d, --debug Print debugging information
Use '--option=?' or '--option help' to see available suboptions
See man page for examples and full option syntax.
- Não sei qual pacote instalar no Fedora/CentOS.
Utilize o
YUM ou o
DNF para listar qual pacote precisa ser instalado:
rlucca@millie:~$ sudo dnf provides '*/virt-manager'_
Ou
rlucca@millie:~$ sudo yum provides '*/virt-install'_
- Não sei qual pacote instalar no Debian/Ubuntu.
Utilize o
DPKG para listar quais pacotes citam o texto "virt-manager":
rlucca@millie:~$ dpkg -S 'virt-manager'_