diff --git a/content/tutorials/how-to-install-virt-manager-on-arch-linux/feature-install-virt-manager.jpg b/content/tutorials/how-to-install-virt-manager-on-arch-linux/feature-install-virt-manager.jpg new file mode 100644 index 0000000..f86bcec Binary files /dev/null and b/content/tutorials/how-to-install-virt-manager-on-arch-linux/feature-install-virt-manager.jpg differ diff --git a/content/tutorials/how-to-install-virt-manager-on-arch-linux/index.id.md b/content/tutorials/how-to-install-virt-manager-on-arch-linux/index.id.md new file mode 100644 index 0000000..3672674 --- /dev/null +++ b/content/tutorials/how-to-install-virt-manager-on-arch-linux/index.id.md @@ -0,0 +1,148 @@ +--- +title: Cara Install Virt-Manager (Libvirt GUI) di Arch Linux +description: Tutorial cara instalasi Virt-Manager, sebuah libvirt GUI untuk mempermudah kita dalam melakukan manajemen mesin virtualiasi atau emulator (KVM/QEMU) di komputer kita. +summary: Tutorial cara instalasi Virt-Manager, sebuah libvirt GUI untuk mempermudah kita dalam melakukan manajemen mesin virtualiasi atau emulator (KVM/QEMU) di komputer kita. +date: 2024-09-11T03:08:45+07:00 +lastmod: +draft: false +noindex: false +nav_weight: 1000 +categories: + - Self-Hosted + - SysAdmin +tags: + - KVM + - libvirt + - QEMU +images: +authors: + - ditatompel +--- + +Saya sudah beberapa kali menulis artikel yang berhubungan dengan +[**KVM**][kvm_web]/[**QEMU**][qemu_web] dan [**Virt-Manager**][virtmanager_web], +tapi saya belum punya tulisan tentang bagaimana cara menginstall dan +mengkonfigurasi Virt-Manager di Arch Linux. Maka ijinkan saya untuk +mendokumentasikannya disini. + +**Virt-Manager** adalah GUI untuk `libvirt` yang dapat mempermudah kita dalam +melakukan manajemen mesin virtualiasi/emulator di komputer kita. + +## Pengantar: Antara KVM dan QEMU + +Sebelum memulai dan agar lebih memahami opsi apa saja yang nantinya bisa +digunakan di _virt-manager_, saya ingin sedikit membahas mengenai **KVM** +dan **QEMU**. Banyak orang beranggapan bahwa KVM dan QEMU adalah suatu hal +yang sama. Hal ini tidak benar. + +**KVM merupakan _full-virtualization_** dimana dia menggunakan _hardware_ untuk +teknologi virtualisasinya. Agar dapat menggunakan tekologi KVM, CPU Anda harus +mensupport virtualisasi (dalam hal ini `Intel VT-x` untuk prosesor **Intel** +dan `AMD-V` untuk prosesor **AMD**). + +Sedangkan **QEMU merupakan sebuah emulator**. Dia dapat melaukan emulasi sistem +secara penuh meskipun _hardware_ yang Anda miliki tidak mensupport virtualiasi. +QEMU dapat melakukan emulasi perangkat seperti _storage_, _network device_, +dan lain-lain. Dia juga dapat melakukan emulasi ke arsitektur CPU yang berbeda, +misalnya: host `x86_64` melakukan emulasi arsitektur ARM pada +_guest virtual machine_-nya. + +Jika dilihat dari sisi performa, KVM jauh lebih unggul dibandingkan QEMU karena +KVM langsung menggunakan hardware. KVM juga sangat optimal untuk virtualiasi +sistem Linux dan menyediakan manajemen sumber daya yang lebih baik daripada +QEMU. + +Dari segi kompatibilitas, QEMU lebih unggul karena dia dapat melakukan emulasi +ke banyak arsitektur CPU, emulasi ke perangkat seperti _storage_, _network_, +_display adapter_, dan lain-lain. QEMU juga tidak memerlukan hardware yang +mensupport teknologi virtualiasi untuk menjalankannya. + +Untuk melakukan pengecekan apakah CPU yang Anda gunakan mensupport virtualisasi +dapat menggunakan perintah: + +```shell +lscpu | grep Virtualization +``` + +Jika perintah diatas tidak menghasilkan output apapun, maka Anda hanya dapat +menggunakan QEMU. + +Jika CPU Anda mensupport virtualiasi Anda dapat menggunakan KVM+QEMU yang +mengkombinasikan akselerasi hardware serta virtualiasi CPU dan RAM secara penuh. + +> **Catatan**: Kebanyakan CPU _mid-range_ hingga _high-end_ yang diproduksi 10 +> tahun terakhir seharusnya mensupport virtualisasi. Jika dari pengecekan +> `lscpu` diatas tidak menghasilkan apapun, silahkan cek konfigurasi BIOS dan +> mengaktifkan fitur tersebut. + +## Instalasi Software Yang Dibutuhkan + +Pertama, install `libvirt`, `dnsmasq`, `qemu-desktop` dan `virt-manager`: + +```shell +sudo pacman -S libvirt dnsmasq qemu-desktop virt-manager +``` + +Disini, `dnsmasq` diperlukan untuk konektifitas jaringan untuk guest (DHCP). +Sedangkan `qemu-desktop` diperlukan untuk desktop GUI. + +Jika Anda hanya menjalankan _virtual machine_ secara _headless_, Anda bisa +mengganti `qemu-desktop` dengan `qemu-base`. Baik `qemu-base` dan +`qemu-desktop` hanya support emulasi `x86_64`. jika Anda akan menggunakan +arsitektur seperti ARM di _virtual machine_, Anda perlu menginstall +`qemu-emulators-full`. + +## Konfigurasi Hak Akses + +Supaya user biasa dapat menggunakan `virt-manager`, tambahkan user Anda ke +group `libvirt` dengan perintah : + +```shell +sudo usermod -aG libvirt +``` + +Kemudian ubah atau tambahkan konfigurasi berikut ke `/etc/libvirt/libvirtd.conf`: + +```plain +unix_sock_group = "libvirt" +unix_sock_ro_perms = "0770" +``` + +konfigurasi diatas mengubah kepemilikan **libvirt UNIX socket** ke group +`libvirt` dan mereka yang berada di dalam group `libvirt` dapat melakukan +_read_ maupun _write_. + +## Menggunakan Virt-Manager + +Sebelum menjalankan GUI (`virt-manager`), jalankan `libvirtd` dengan perintah: + +```shell +sudo systemctl start libvirtd +``` + +Hal ini supaya kita dapat menggunakan QEMU/KVM tidak pada **user session** +sehingga _guest machine_ nantinya dapat terkoneksi ke jaringan. + +{{< youtube Y01SwRqkX8I >}} + +Setelah _libvirt daemon_ berjalan, Anda bisa menjalankan `virt-manager` dan +mulai menambahkan koneksi `QEMU/KVM`. Setelah itu cobalah membuat +_virtual machine_ yang ingin dicoba. Jika mengalami kesulitan, mengikuti video +yang saya sertakan diatas mungkin sedikit banyak dapat membantu. + +Untuk menjalankan Windows VM, Anda memerlukan `swtpm` dan mengkonfigurasi +TPM hardware. Silahkan baca artikel saya sebelumnya: +["Menjalankan Windows 11 VM (TPM dan Secure-Boot) di Linux"]({{< ref "/tutorials/run-windows-11-tpm-and-secure-boot-on-kvm" >}}). + +## Referensi + +- [KVM Arch Wiki][kvm_aw] +- [QEMU Arch Wiki][qemu_aw] +- [Virt-Manager Arch Wiki][virtmanager_aw] + +[kvm_web]: https://linux-kvm.org/page/Main_Page "KVM Website" +[kvm_aw]: https://wiki.archlinux.org/title/KVM "KVM Arch Wiki" +[qemu_web]: https://www.qemu.org/ "QEMU Website" +[qemu_aw]: https://wiki.archlinux.org/title/QEMU "QEMU Arch Wiki" +[virtmanager_web]: https://virt-manager.org/ "Virt-Manager official website" +[virtmanager_aw]: https://wiki.archlinux.org/title/Virt-manager "Virt Manager Arch Wiki" diff --git a/content/tutorials/how-to-install-virt-manager-on-arch-linux/index.md b/content/tutorials/how-to-install-virt-manager-on-arch-linux/index.md new file mode 100644 index 0000000..304eed9 --- /dev/null +++ b/content/tutorials/how-to-install-virt-manager-on-arch-linux/index.md @@ -0,0 +1,148 @@ +--- +title: How to Install Virt-Manager (Libvirt GUI) on Arch Linux +description: Tutorial on how to install Virt-Manager, a graphical user interface for libvirt that makes it easier for us to manage KVM/QEMU virtualization machines on our computers. +summary: Tutorial on how to install Virt-Manager, a graphical user interface for libvirt that makes it easier for us to manage KVM/QEMU virtualization machines on our computers. +# linkTitle: +date: 2024-09-11T03:08:45+07:00 +lastmod: +draft: false +noindex: false +# comments: false +nav_weight: 1000 +categories: + - Self-Hosted + - SysAdmin +tags: + - KVM + - libvirt + - QEMU +images: +authors: + - ditatompel +--- + +I have written several articles related to [**KVM**][kvm_web]/[**QEMU**][qemu_web] +and [**Virt-Manager**][virtmanager_web], but I have not written about how to +install and configure Virt-Manager on Arch Linux. This is a tutorial that will +cover both aspects. + +**Virt-Manager** is a graphical user interface (GUI) for `libvirt` that makes +it easier for us to manage virtualization machines or emulators on our +computers. + +## Introduction: Between KVM and QEMU + +Before we begin and to better understand the options available in +`virt-manager`, I would like to discuss a brief overview of KVM and QEMU. +Many people assume that KVM and QEMU are one and the same thing. However, +this is not true. + +**KVM is a full virtualization** technology that utilizes hardware for its +virtualization capabilities. To use KVM, your CPU must support virtualization +(in this case, `Intel VT-x` for **Intel processors** and `AMD-V` for +**AMD processors**). + +On the other hand, **QEMU is an emulator**. It can emulate a complete system +even if the hardware you have does not support virtualization. QEMU can emulate +devices such as storage, network interfaces, and others. Moreover, it can also +emulate different CPU architectures: for example, an `x86_64` host can emulate +the `ARM` architecture on a guest virtual machine. + +In terms of performance, KVM is significantly superior to QEMU because it +utilizes hardware directly. As such, KVM is very optimal for Linux system +virtualization and provides better resource management than QEMU. + +In terms of compatibility, QEMU is superior due to its ability to emulate many +CPU architectures, emulate devices such as storage, network, display adapters, +and others. Additionally, QEMU does not require hardware that supports +virtualization technology to run it. + +To verify whether the CPU you are using supports virtualization, you can use +the command: + +```shell +lscpu | grep Virtualization +``` + +If the command above produces no output, then you can only use QEMU. However, +if your CPU does support virtualization, you can utilize KVM + QEMU, which +combines hardware acceleration with full CPU and memory virtualization. + +> **Note:** Most mid-range to high-end CPUs manufactured within the last 10 +> years should support virtualization. If the `lscpu` check above does not +> produce any output, please check your BIOS configuration and ensure that +> the feature is enabled. + +## Required Software Installation + +First, install `libvirt`, `dnsmasq`, `qemu-desktop`, and `virt-manager` using +the following command: + +```shell +sudo pacman -S libvirt dnsmasq qemu-desktop virt-manager +``` + +Here, `dnsmasq` is necessary for guest network connectivity (DHCP). +Additionally, `qemu-desktop` is required to enable GUI desktop support. If you +plan to run virtual machines headless only, you can replace `qemu-desktop` with +`qemu-base`. Note that both `qemu-base` and `qemu-desktop` are limited to +`x86_64` emulation. However, if you intend to use architectures like ARM in +your virtual machines, you will need to install the `qemu-emulators-full` +package. + +## Access Rights Configuration + +To enable regular users to use `virt-manager`, add your user to the `libvirt` +group using the following command: + +```shell +sudo usermod -aG libvirt +``` + +Next, modify or add the following configuration to `/etc/libvirt/libvirtd.conf`: + +```plain +unix_sock_group = "libvirt" +unix_sock_ro_perms = "0770" +``` + +The above configuration sets the group access rights for +**libvirt UNIX socket** to the `libvirt` group, allowing members of this group +to perform read and write operations. + +## Using Virt-Manager + +Before running `virt-manager` in GUI mode, start the **libvirt daemon** using +the following command: + +```shell +sudo systemctl start libvirtd +``` + +This is necessary to enable QEMU/KVM operations outside of your **user session** +and allow the guest machine to connect to the network later. + +{{< youtube Y01SwRqkX8I >}} + +Once the libvirt daemon is running, you can run `virt-manager` and begin adding +QEMU/KVM connections. After that, try creating the virtual machine you want to +test. If you encounter difficulties, referring to the video included above may +provide some assistance. + +To run Windows VM, you will need `swtpm` and configure TPM. For more +information, please refer to my previous article: +["Running Windows 11 VM (TPM And Secure-Boot) On Linux"]({{< ref "/tutorials/run-windows-11-tpm-and-secure-boot-on-kvm" >}}). +You can also use VirtIO-FS for [sharing data between the host and guest virtual machines]({{< ref "/tutorials/virt-manager-sharing-data-between-host-and-guests-libvirt-virtio-fs" >}}). + +## Resources + +- [KVM Arch Wiki][kvm_aw] +- [QEMU Arch Wiki][qemu_aw] +- [Virt-Manager Arch Wiki][virtmanager_aw] + +[kvm_web]: https://linux-kvm.org/page/Main_Page "KVM Website" +[kvm_aw]: https://wiki.archlinux.org/title/KVM "KVM Arch Wiki" +[qemu_web]: https://www.qemu.org/ "QEMU Website" +[qemu_aw]: https://wiki.archlinux.org/title/QEMU "QEMU Arch Wiki" +[virtmanager_web]: https://virt-manager.org/ "Virt-Manager official website" +[virtmanager_aw]: https://wiki.archlinux.org/title/Virt-manager "Virt Manager Arch Wiki"