-
Notifications
You must be signed in to change notification settings - Fork 1
/
libvirt.txt
72 lines (61 loc) · 2.5 KB
/
libvirt.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Hypervisors (virtual machine monitors)
native, bare metal hypervisors: (KVM)
hardware -> hypervisor -> guest OSs
hosted hypervisors: (VMware, VirtualBox, QEMU (Quick Emulator), KVM)
hardware -> OS -> hypervisor -> guest OSs
KVM (Kernel Virtual Machine) is a Linux kernel module that allows a user space
program to utilize the hardware virtualization features of various processors
QEMU uses emulation; KVM uses processor extensions (HVM) for virtualization.
Libvirt
System URIs connect to the system libvirtd daemon (started by system
init scripts), which is shared among all users on the machine, and which
allows access to anything that requires superuser capabilities (such as
creating tun devices for networking).
Session URIs connect to a per-user daemon (which will be started
automatically if needed), and which cannot access anything that the user
cannot access (and unfortunately, given that no one has yet figured out
how to make Linux share tun devices with ordinary users, that means that
session guests are currently rather limited because they will not have
networking support). The goal is to make things support full
virtualization under session URIs, once the kernel adds the support we
need for networking.
# uuid: globally unique identifier for the virtual machine, generated if omitted
# acpi on/off? acpid would be needed (libvirt tips)
#
# --os-variant is HIGHLY RECOMMENDED:
# osinfo-query os
# virt-install --os-variant=list # for older versions
#
# full virtualization (--hvm) is the default
# virsh desc domain
# virsh list --title --all
# virt-install --memory=?
# virsh domdisplay
# --disk vol=images_lvm/home,size=64,sparse=no,format=lvm2 \
# --extra-args console=ttyS0,115200 \
# --console pty,target_type=serial \
#
# fallocate -l64G centos7.img
# virsh pool-define-as images_lvm logical - - /dev/sda2 cl /dev/cl
# virsh pool-autostart images_lvm
virt-install \
--name xxx \
--memory 4096 \
--metadata title='xxx',description='xxx' \
--events on_crash=restart,on_poweroff=destroy,on_reboot=restart \
--vcpus 2 \
--features acpi=off \
--clock offset=utc \
--location http://mirror.cov.ukservers.com/centos/7/os/x86_64/ \
--os-variant centos7.0 \
--boot hd \
--disk /home/libvirt/images/centos7.img,sparse=no \
--network bridge=virbr0 \
--graphics vnc,port=5901,password=XXX \
--hvm \
--virt-type kvm \
--dry-run
Change virbr0 to br0 later with virsh edit your_domain + manually set the network via VNC
VNC:
command ssh -fNL 5901:127.0.0.1:5901 remote_host
screen sharing: vnc://127.0.0.1:5901