Manjaro Difference between revisions of "Virt-manager/ru"

Difference between revisions of "Virt-manager/ru"

From Manjaro
(Created page with "==Настройка параметров дисплея== По умолчанию используется модель видеокарты QXL. Если ваша вирту...")
Tags: Mobile web edit Mobile edit
(Updating to match new version of source page)
Line 65: Line 65:
<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
= Using Virt-Manager for guest creation=
= Using Virt-Manager for guest creation=
<br clear="all" />
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
0. Prepare installation image. If you're going to install Windows, prepare the [https://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers Virtio driver] image too.
0. Prepare installation image. If you're going to install Windows, prepare the [https://www.linux-kvm.org/page/WindowsGuestDrivers/Download_Drivers Virtio driver] image too.
{{tip|You can also find the [https://aur.archlinux.org/packages/virtio-win virtio-win] package in AUR. The image is located in '''/var/lib/libvirt/images''', which is the default [https://libvirt.org/storage.html#StorageBackendDir directory pool] of qemu:///system}}
{{tip|You can also find the [https://aur.archlinux.org/packages/virtio-win virtio-win] package in AUR. The image is located in '''/var/lib/libvirt/images''', which is the default [https://libvirt.org/storage.html#StorageBackendDir directory pool] of qemu:///system}}
<br clear="all" />
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
1. Launch menu Virtual Machine Manager. It should already have a [https://libvirt.org/drvlxc.html LXC] connection. You can disconnect and remove it if you don't use LXC.
1. Launch menu Virtual Machine Manager. It should already have a [https://libvirt.org/drvlxc.html LXC] connection. You can disconnect and remove it if you don't use LXC.
<br clear="all" />
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
2. Go to File, choose Add Connection and choose hypervisor QEMU/KVM, or QEMU/KVM user session if you don't want '''system'''-level virtual machines. Click on connect.
2. Go to File, choose Add Connection and choose hypervisor QEMU/KVM, or QEMU/KVM user session if you don't want '''system'''-level virtual machines. Click on connect.
<br clear="all" />
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
3. You need directory pools to store the disk images of virtual machines or the ISO file of CD/DVD. Double click qemu/kvm, go on storage and add by clicking + the path to the folder where you have the iso and the folder where create the virtual machine.
3. You need directory pools to store the disk images of virtual machines or the ISO file of CD/DVD. Double click qemu/kvm, go on storage and add by clicking + the path to the folder where you have the iso and the folder where create the virtual machine.
<br clear="all" />
</div>
{{tip|My advice: use a different partition than the root. In case you need to reinstall your operating system you don't lose the VM that already ready-to-start.}}
 
<div lang="en" dir="ltr" class="mw-content-ltr">
{{BoxInfo|tip|My advice: use a different partition than the root. In case you need to reinstall your operating system you don't lose the VM that already ready-to-start.}}
4. Click on create a new virtual machine: select '''Local install media (ISO image or CDROM)''', and select the installation ISO image and OS type (if not detected).
4. Click on create a new virtual machine: select '''Local install media (ISO image or CDROM)''', and select the installation ISO image and OS type (if not detected).
<br clear="all" />
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
5. How many CPU assign and how much memory? (check the recommended requirements of O.S. that you are installing)
5. How many CPU assign and how much memory? (check the recommended requirements of O.S. that you are installing)
<br clear="all" />
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
6. Create the file system of the virtual machine by selecting '''Select or create custom storage''' and click '''Manage...'''. Under your desired directory pool, create the volume of the virtual machine (default in qcow2 format).  How many GB? Check the recommended requirements O.S. you install.
6. Create the file system of the virtual machine by selecting '''Select or create custom storage''' and click '''Manage...'''. Under your desired directory pool, create the volume of the virtual machine (default in qcow2 format).  How many GB? Check the recommended requirements O.S. you install.
<br clear="all" />
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
7.Assign a name to the machine and flag '''customize configuration before install'''. You have access to the screen with all the hardware that will be virtualized, do a check if there is all that is needed to initialize and launch the installer.
7.Assign a name to the machine and flag '''customize configuration before install'''. You have access to the screen with all the hardware that will be virtualized, do a check if there is all that is needed to initialize and launch the installer.
<br clear="all" />
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
8. In ''Overview'', change the firmware to UEFI for future-proof capacity.
8. In ''Overview'', change the firmware to UEFI for future-proof capacity.
<br clear="all" />
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
9. Change the type of SATA Disk 1 (the disk image of the creating virtual machine) to ''virtio'' for better performance. Change discard mode to ''unmap'', and then apply the change. You should notice the device name would change from SATA Disk 1 to VirtIO Disk 1.
9. Change the type of SATA Disk 1 (the disk image of the creating virtual machine) to ''virtio'' for better performance. Change discard mode to ''unmap'', and then apply the change. You should notice the device name would change from SATA Disk 1 to VirtIO Disk 1.
{{warning| If you're installing Windows, make sure to create a new SATA CDROM device and select the '''virtio-win''' image as the media, so that the Windows Installer can load the driver to recognize the disk. The virtio storage driver should be located at somewhere like ''E:\viostor\w10\amd64''}}
{{BoxWarning|Warning|If you're installing Windows, make sure to create a new SATA CDROM device and select the '''virtio-win''' image as the media, so that the Windows Installer can load the driver to recognize the disk. The virtio storage driver should be located at somewhere like ''E:\viostor\w10\amd64''}}
10. Set the NIC type to virtio too for better network performance.
10. Set the NIC type to virtio too for better network performance.
{{note| If you're installing Windows, once the system if ready, make sure to install all the virtio drivers so that your virtIO network can work normally}}
{{BoxInfo|Note|If you're installing Windows, once the system if ready, make sure to install all the virtio drivers so that your virtIO network can work normally}}
11. Add TPM chip, select '''TIS''' model through '''Emulated device''' backend.
11. Add TPM chip, select '''TIS''' model through '''Emulated device''' backend.
<br clear="all" />
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
12. Add a watchdog to reboot the guest when it hangs. Leave the settings as default.
12. Add a watchdog to reboot the guest when it hangs. Leave the settings as default.
<br clear="all" />
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
13. And a hardware RNG, to get entropy from the host.
13. And a hardware RNG, to get entropy from the host.
<br clear="all" />
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
14. Click on the top to start installation.
14. Click on the top to start installation.
<br clear="all" />
{{warning|'''All these steps are visible on youtube.''' '''[https://youtu.be/DiUG_hlLk3c >>> PLAY THIS] [[File:YouTube_1.png|thumb|center|300px]]'''}}
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
{{BoxWarning|Warning|'''All these steps are visible on youtube.''' '''[https://youtu.be/DiUG_hlLk3c >>> PLAY THIS] [[File:YouTube_1.png|thumb|center|300px]]'''}}
</div>
<div class="mw-translate-fuzzy">
==Установка гостевых дополнений==
==Установка гостевых дополнений==
После запуска и работы виртуальной машины необходимо установить [https://www.spice-space.org/download.html spice guest tools].
После запуска и работы виртуальной машины необходимо установить [https://www.spice-space.org/download.html spice guest tools].
Line 109: Line 138:
<br clear="all" />
<br clear="all" />
Посетите: '''[http://www.spice-space.org/download.html страницу загрузки Spice]'''
Посетите: '''[http://www.spice-space.org/download.html страницу загрузки Spice]'''
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
For Windows is a single package: spice-guest-tools-xxxx.exe
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
For linux are: spice-vdagent and xf86-video-qxl. If you visrtualize a linux distro you can install them with their package manager
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
Visit: '''[http://www.spice-space.org/download.html Spice download]'''
</div>


==Настройка параметров дисплея==
==Настройка параметров дисплея==

Revision as of 06:17, 15 February 2023

Other languages:
English • ‎Türkçe • ‎русский

Обзор

Topbar logo.png


Подсказка
Слышали ли вы о Virtualbox для виртуализации операционных систем, таких как Linux и Windows или Mac? Это хорошее программное обеспечение, но не единственное! Не забывайте о VMware, Gnome Boxes и ... virt-manager.



Virt-manager использует libvirt и является менеджером многих гипервизоров, включая тот, который мы хотим использовать здесь: QEMU/KVM.



Зачем мне нужна виртуализация?

  • Чтобы узнать о новой ОС
  • Для настройки оборудования, которое имеет настройки только для этой операционной системы
  • Для использования программного обеспечения, которое работает только на другой

Я хочу знать больше

Hypervisor 1.png


1. Виртуализация
2. Гипервизор
3. Виртуальная машина

Что мы точно должны знать


1. Какой у меня процессор. Определите его и убедитесь, что он как минимум четырехъядерный. ПОСМОТРИТЕ НА CPU-World
2. Проверьте, включены ли "параметры виртуализации" в BIOS, используя

LC_ALL=C lscpu | grep Virtualization

3. Сколько у меня памяти. Проверьте оперативную память и убедитесь, что она составляет не менее 4 ГБ.
4. Количество свободного места на жестком диске. Виртуальная машина может использовать файл образа диска, поэтому дополнительные разделы не нужны.

Примечание
Вы также можете использовать необработанные разделы, специально предназначенные для виртуальных машин. Дополнительную информацию см. в разбиение на разделы

5. Минимальные требования к аппаратному обеспечению операционной системы, которую вы хотите установить в качестве виртуальной машины.

Установите virt-manager, qemu и все зависимости


Через терминал:

sudo pacman -S --needed virt-manager qemu-desktop libvirt edk2-ovmf dnsmasq iptables-nft

Для поддержки TPM:

sudo pacman -S --asdeps swtpm

Добавить в автозапуск и запустить службу:

sudo systemctl enable libvirtd.service
sudo systemctl start libvirtd.service

Добавьте пользователя в группу libvirt для использования виртуальных машин уровня system (qemu:///system)

sudo usermod -a -G libvirt $USER
Примечание
  1. Вам не нужен этот шаг для запуска виртуальных машин системного уровня. Однако virt-manager запросит пароль sudoer'а при запуске, если пользователь не входит в группу libvirt.
  2. Вы также можете создавать виртуальные машины уровня пользователя (qemu:///session) и использовать их без прав sudoer. Однако некоторые функции, такие как Sharing files with Virtiofs, могут быть недоступны в qemu:///session

Using Virt-Manager for guest creation

0. Prepare installation image. If you're going to install Windows, prepare the Virtio driver image too.


Tip
You can also find the virtio-win package in AUR. The image is located in /var/lib/libvirt/images, which is the default directory pool of qemu:///system

1. Launch menu Virtual Machine Manager. It should already have a LXC connection. You can disconnect and remove it if you don't use LXC.

2. Go to File, choose Add Connection and choose hypervisor QEMU/KVM, or QEMU/KVM user session if you don't want system-level virtual machines. Click on connect.

3. You need directory pools to store the disk images of virtual machines or the ISO file of CD/DVD. Double click qemu/kvm, go on storage and add by clicking + the path to the folder where you have the iso and the folder where create the virtual machine.

tip
My advice: use a different partition than the root. In case you need to reinstall your operating system you don't lose the VM that already ready-to-start.

4. Click on create a new virtual machine: select Local install media (ISO image or CDROM), and select the installation ISO image and OS type (if not detected).

5. How many CPU assign and how much memory? (check the recommended requirements of O.S. that you are installing)

6. Create the file system of the virtual machine by selecting Select or create custom storage and click Manage.... Under your desired directory pool, create the volume of the virtual machine (default in qcow2 format). How many GB? Check the recommended requirements O.S. you install.

7.Assign a name to the machine and flag customize configuration before install. You have access to the screen with all the hardware that will be virtualized, do a check if there is all that is needed to initialize and launch the installer.

8. In Overview, change the firmware to UEFI for future-proof capacity.

9. Change the type of SATA Disk 1 (the disk image of the creating virtual machine) to virtio for better performance. Change discard mode to unmap, and then apply the change. You should notice the device name would change from SATA Disk 1 to VirtIO Disk 1.

Warning
If you're installing Windows, make sure to create a new SATA CDROM device and select the virtio-win image as the media, so that the Windows Installer can load the driver to recognize the disk. The virtio storage driver should be located at somewhere like E:\viostor\w10\amd64

10. Set the NIC type to virtio too for better network performance.

Note
If you're installing Windows, once the system if ready, make sure to install all the virtio drivers so that your virtIO network can work normally

11. Add TPM chip, select TIS model through Emulated device backend.

12. Add a watchdog to reboot the guest when it hangs. Leave the settings as default.

13. And a hardware RNG, to get entropy from the host.

14. Click on the top to start installation.

Warning
All these steps are visible on youtube. >>> PLAY THIS
YouTube 1.png

Установка гостевых дополнений

После запуска и работы виртуальной машины необходимо установить spice guest tools.
Для Windows это один пакет: spice-guest-tools-xxxx.exe
Для linux это: spice-vdagent и xf86-video-qxl. Если вы используете дистрибутив linux, то можете установить их с помощью менеджера пакетов.
Посетите: страницу загрузки Spice

For Windows is a single package: spice-guest-tools-xxxx.exe

For linux are: spice-vdagent and xf86-video-qxl. If you visrtualize a linux distro you can install them with their package manager

Настройка параметров дисплея

По умолчанию используется модель видеокарты QXL. Если ваша виртуальная машина - система Linux, вы можете изменить ее на virtio и включить 3D-ускорение для лучшей графической производительности.
Виртуальная машина Windows, однако, пока не поддерживает virtio дисплей. Тем не менее, мы можем увеличить ее VGA память с 16 МБ по умолчанию до 64 МБ, чтобы обеспечить более высокое разрешение дисплея и немного улучшить 2D графическую производительность.
Для этого нам нужно отредактировать XML-файл виртуальной машины.

  1. В virt-manager перейдите в edit > preference и отметьте Enable XML edit.
  2. В сведениях о виртуальной машине перейдите к видеокарте. На вкладке XML измените значение vgamem на 65536, затем примените изменения.


Обмен файлами между хостом и гостем

Для гостевых систем Linux доступны Virtio-FS и 9p для совместного использования файлов. Дополнительную информацию см. в ArchWiki.
Для гостевых систем Windows самым простым способом обмена файлами между хостом и гостем является SAMBA.

  1. Создайте SAMBA usershare
  2. В гостевой Windows введите \\\192.168.122.1 в файловом проводнике и сможете увидеть usershare на вашем хосте.
  3. Сопоставьте этот SAMBA usershare с новым диском и подключитесь к нему с соответствующими учетными данными. Вот и все.

Дополнительную информацию можно найти в этой статье.

Оптимизация vCPU

Посмотрите эту статью, как настроить топологию vCPU для лучшей производительности.
Например, мой процессор имеет 1 сокет, 8 ядер и 16 потоков. Автоматическая топология назначает моему гостю 4 сокета, 1 ядро и 1 поток. После изменения на 1 сокет, 4 ядра и 1 поток производительность значительно увеличивается.

Рекомендации

Virt-manager
Libvirt
Qemu
x86 virtualization
Intel-vt
Amd-v

Cookies help us deliver our services. By using our services, you agree to our use of cookies.