Здесь показаны различия между двумя версиями данной страницы.
Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия | ||
howto:linux:kvm [2014/12/29 21:59] Алексей Кожевников |
howto:linux:kvm [2019/01/17 11:09] (текущий) Алексей Кожевников ↷ Страница перемещена из installation:linux:kvm в howto:linux:kvm |
||
---|---|---|---|
Строка 1: | Строка 1: | ||
====== KVM ====== | ====== KVM ====== | ||
+ | |||
Проверка аппаратной виртуализации:\\ | Проверка аппаратной виртуализации:\\ | ||
''cat /proc/cpuinfo | egrep 'flags.*(svm|vmx)''' | ''cat /proc/cpuinfo | egrep 'flags.*(svm|vmx)''' | ||
+ | |||
+ | ''tasksel install virt-host'' | ||
+ | ===== lvm pool ===== | ||
+ | |||
+ | ''/etc/libvirt/storage/vg01.xml'' | ||
+ | <code> | ||
+ | <pool type='logical'> | ||
+ | <name>vg01</name> | ||
+ | <target> | ||
+ | <path>/dev/vg01</path> | ||
+ | </target> | ||
+ | </pool> | ||
+ | </code> | ||
+ | |||
+ | ''virsh pool-define /etc/libvirt/storage/vg01.xml\\ | ||
+ | virsh pool-start vg01\\ | ||
+ | virsh pool-autostart vg01\\ | ||
+ | virsh pool-info vg01'' | ||
===== virt-install ===== | ===== virt-install ===== | ||
+ | |||
+ | ''apt-get install virtinst'' | ||
+ | |||
+ | <code>virt-install --os-variant list</code> | ||
==== Linux ==== | ==== Linux ==== | ||
+ | === Ubuntu 14.04 === | ||
''lvcreate -L51200 -n nti09 /dev/vg01'' | ''lvcreate -L51200 -n nti09 /dev/vg01'' | ||
''virsh pool-refresh vg01'' | ''virsh pool-refresh vg01'' | ||
- | |||
<code> | <code> | ||
virt-install --connect=qemu:///system \ | virt-install --connect=qemu:///system \ | ||
Строка 28: | Строка 51: | ||
</code> | </code> | ||
+ | === RHEL 6 === | ||
+ | == LVM, iso, vnc == | ||
+ | |||
+ | ''lvcreate -L51200 -n nti08 /dev/vg01'' | ||
+ | |||
+ | ''virsh pool-refresh vg01'' | ||
+ | <code> | ||
+ | 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 | ||
+ | </code> | ||
+ | |||
+ | == img, net, console == | ||
+ | |||
+ | <code> | ||
+ | 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 | ||
+ | </code> | ||
+ | |||
+ | |||
+ | === RHEL 7 === | ||
+ | |||
+ | <code> | ||
+ | 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 | ||
+ | </code> | ||
==== Windows ==== | ==== Windows ==== | ||
Строка 33: | Строка 122: | ||
''virsh pool-refresh vg01'' | ''virsh pool-refresh vg01'' | ||
- | |||
<code> | <code> | ||
virt-install --connect=qemu:///system \ | virt-install --connect=qemu:///system \ | ||
Строка 49: | Строка 137: | ||
--hvm \ | --hvm \ | ||
--noautoconsole | --noautoconsole | ||
+ | </code> | ||
+ | |||
+ | ===== attach-interface ===== | ||
+ | <code> | ||
+ | virsh attach-interface --domain web9 --type bridge --source br1790 --model virtio --config | ||
+ | virsh detach-interface web9 bridge --mac '52:54:00:e5:6b:eb' | ||
</code> | </code> | ||
Строка 56: | Строка 150: | ||
Подключить образ: | Подключить образ: | ||
+ | |||
<code> | <code> | ||
virsh attach-disk guest01 /root/disc1.iso hdc –driver file –type cdrom –mode readonly | virsh attach-disk guest01 /root/disc1.iso hdc –driver file –type cdrom –mode readonly | ||
Строка 61: | Строка 156: | ||
Отключить образ: | Отключить образ: | ||
+ | |||
<code> | <code> | ||
virsh attach-disk vguest01 " " hdc –driver file –type cdrom –mode readonly | virsh attach-disk vguest01 " " hdc –driver file –type cdrom –mode readonly | ||
Строка 68: | Строка 164: | ||
''virsh edit guest01'' | ''virsh edit guest01'' | ||
- | |||
<code> | <code> | ||
<os> | <os> | ||
Строка 87: | Строка 182: | ||
</code> | </code> | ||
- | ===== attach-device ====== | + | |
+ | ===== attach-device ===== | ||
''virsh attach-device nti02 /etc/libvirt/qemu/devices/usbpwc2.xml'' | ''virsh attach-device nti02 /etc/libvirt/qemu/devices/usbpwc2.xml'' | ||
Строка 99: | Строка 195: | ||
</code> | </code> | ||
- | {{tag> linux kvm virt-install attach-device }} | + | {{tag> linux Ubuntu kvm virt-install attach-device }} |