====== KVM ======
Проверка аппаратной виртуализации:\\
''cat /proc/cpuinfo | egrep 'flags.*(svm|vmx)'''
''tasksel install virt-host''
===== lvm pool =====
''/etc/libvirt/storage/vg01.xml''
vg01
/dev/vg01
''virsh pool-define /etc/libvirt/storage/vg01.xml\\
virsh pool-start vg01\\
virsh pool-autostart vg01\\
virsh pool-info vg01''
===== virt-install =====
''apt-get install virtinst''
virt-install --os-variant list
==== Linux ====
=== Ubuntu 14.04 ===
''lvcreate -L51200 -n nti09 /dev/vg01''
''virsh pool-refresh vg01''
virt-install --connect=qemu:///system \
--name=nti09 \
--cpu host \
--vcpus=1,sockets=1,cores=1,threads=1 \
--ram=512 \
--os-type=linux \
--os-variant=ubuntutrusty \
--disk vol=vg01/nti09,bus=virtio,cache=none \
--cdrom=/tmp/ubuntu-14.04.1-server-amd64.iso \
--network bridge:br0,model=virtio \
--graphics vnc,listen=0.0.0.0,port=46599,password=zzzzzz \
--accelerate \
--hvm \
--noautoconsole
=== RHEL 6 ===
== LVM, iso, vnc ==
''lvcreate -L51200 -n nti08 /dev/vg01''
''virsh pool-refresh vg01''
virt-install --connect=qemu:///system \
--name=nti08 \
--cpu host \
--vcpus=1,sockets=1,cores=1,threads=1 \
--ram=512 \
--os-type=linux \
--os-variant=rhel6 \
--disk vol=vg01/nti08,bus=virtio,cache=none \
--cdrom=/tmp/CentOS-6.6-x86_64-minimal.iso \
--network bridge:br0,model=virtio \
--graphics vnc,listen=0.0.0.0,port=46598,password=zzzzzz \
--accelerate \
--hvm \
--noautoconsole
== img, net, console ==
virt-install --connect=qemu:///system \
--name=mon-proxy \
--cpu host \
--vcpus=1,sockets=1,cores=1,threads=2 \
--ram=1024 \
--os-type=linux \
--os-variant=rhel6 \
--disk path=/srv/virtual/mon_proxy.img,bus=virtio,size=50 \
--location=http://mirror.yandex.ru/centos/6/os/x86_64/ \
--network bridge:br201,model=virtio \
--network bridge:br1790,model=virtio \
--network bridge:br3044,model=virtio \
--graphics vnc,listen=0.0.0.0 \
--accelerate \
--hvm
=== RHEL 7 ===
lvcreate -L50000 -n vm-adm1-root /dev/vg01
virsh pool-refresh vg01
virt-install --connect=qemu:///system \
--name=adm1 \
--cpu host \
--vcpus=1,sockets=1,cores=2,threads=1 \
--ram=512 \
--os-type=linux \
--os-variant=rhel7 \
--disk vol=vg01/vm-adm1-root,bus=virtio,cache=none \
--location=http://mirror.yandex.ru/centos/7/os/x86_64/ \
--network bridge:br0,model=virtio \
--nographics \
--extra-args='console=tty0 console=ttyS0,115200n8' \
--accelerate \
--hvm
==== Windows ====
''lvcreate -L102500 -n nti02 /dev/vg01''
''virsh pool-refresh vg01''
virt-install --connect=qemu:///system \
--name=nti02 \
--cpu host \
--vcpus=8,sockets=1,cores=8,threads=1 \
--ram=12288 \
--os-type=windows \
--os-variant=win2k8 \
--disk vol=vg01/nti02,bus=virtio,cache=none \
--cdrom=/bak/iso/ru_windows_server_2008_r2_standard_enterprise_datacenter_web_vl_build_x64_dvd_x15-59789.iso \
--network bridge:br0,model=virtio \
--graphics vnc,listen=0.0.0.0,port=46591,password=zzzzzz \
--accelerate \
--hvm \
--noautoconsole
===== attach-interface =====
virsh attach-interface --domain web9 --type bridge --source br1790 --model virtio --config
virsh detach-interface web9 bridge --mac '52:54:00:e5:6b:eb'
===== attach-disk =====
Подключить образ:
virsh attach-disk guest01 /root/disc1.iso hdc –driver file –type cdrom –mode readonly
Отключить образ:
virsh attach-disk vguest01 " " hdc –driver file –type cdrom –mode readonly
===== Boot from cdrom =====
''virsh edit guest01''
hvm
===== attach-device =====
''virsh attach-device nti02 /etc/libvirt/qemu/devices/usbpwc2.xml''
{{tag> linux Ubuntu kvm virt-install attach-device }}