
{"id":47654,"date":"2024-12-04T15:40:59","date_gmt":"2024-12-04T15:40:59","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=47654"},"modified":"2026-05-08T07:46:38","modified_gmt":"2026-05-08T07:46:38","slug":"kvm-qemu-virtual-machines-ubuntu","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2024\/12\/kvm-qemu-virtual-machines-ubuntu\/","title":{"rendered":"Install &#038; Setup QEMU\/KVM to Run Virtual Machines in Ubuntu 26.04, 24.04"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kvm-icon.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-47655\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kvm-icon-250x250.webp\" alt=\"\" width=\"250\" height=\"250\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kvm-icon-250x250.webp 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kvm-icon-300x300.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kvm-icon-700x700.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kvm-icon-768x768.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kvm-icon.webp 1200w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p>This is a step by step guide shows how to install and manage virtual machines using qemu\/kvm solution in Ubuntu 24.04 or Ubuntu 26.04 LTS.<\/p>\n<p>KVM, <b>K<\/b>ernel-based <b>V<\/b>irtual <b>M<\/b>achine, is a module in Linux Kernel that can function as a hypervisor. It offers a high performance virtualization environment with hardware virtualization extensions, such as Intel VT or AMD-V that&#8217;s built in CPU.<\/p>\n<p>KVM does not directly function in user-space. It requires a user-space application, such as QEMU, to interact with it and manage virtual machines.<\/p>\n<p>As QEMU is a command line tool, there&#8217;s also graphical tool, such as Virtual Machine Manager, to make it easy to use.<\/p>\n<p><!--more--><\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kubuntu-inqemukvm.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47656\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kubuntu-inqemukvm-700x535.webp\" alt=\"\" width=\"610\" height=\"466\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kubuntu-inqemukvm-700x535.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kubuntu-inqemukvm-300x229.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kubuntu-inqemukvm-768x587.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kubuntu-inqemukvm.webp 985w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<h3>1. Load KVM Kernel module and install QEMU:<\/h3>\n<p>The KVM module requires host machine&#8217;s processor has virtualization support. It&#8217;s <b>VT-x<\/b> for Intel processors and <b>AMD-V<\/b> for AMD processors. And, all the Intel and AMD CPUs in past 10 years support virtualization.<\/p>\n<p><b>To check if your CPU support virtualization<\/b>, open terminal (Ctrl+Alt+T) and run command:<\/p>\n<pre>LC_ALL=C.UTF-8 lscpu | grep Virtualization<\/pre>\n<p>If it outputs nothing, then make sure you have enabled the virtualization support in your BIOS.<\/p>\n<p><b>And, check if KVM module loaded<\/b>, run command:<\/p>\n<pre>lsmod | grep kvm<\/pre>\n<p>The kernel module is usually loaded by default in Ubuntu. If NOT, try <code>sudo modprobe -a kvm kvm_intel<\/code> to load it (replace <code>kvm_intel<\/code> with <code>kvm_amd<\/code> for AMD processor).<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kvm-module.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47657\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kvm-module-700x213.webp\" alt=\"\" width=\"610\" height=\"186\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kvm-module-700x213.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kvm-module-300x91.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/kvm-module.webp 706w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p><b>To install QEMU<\/b> in Debian, Ubuntu, Linux Mint and their based systems, run command:<\/p>\n<pre>sudo apt install qemu-system<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/apt-qume.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47658\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/apt-qume-700x555.webp\" alt=\"\" width=\"610\" height=\"484\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/apt-qume-700x555.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/apt-qume-300x238.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/apt-qume-768x609.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/apt-qume.webp 770w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<h3>2. Create Virtual Machine from command line<\/h3>\n<p><b>NOTE: If you hate Linux commands, just skip this step and use the graphical tool in next step!<\/b><\/p>\n<p><b>1. First create a virtual disk<\/b> image file by running similar command below:<\/p>\n<pre>qemu-img create -f raw \/media\/ji\/600g\/windows10.raw 80G<\/pre>\n<p>Here you need to replace the command options accordingly. They are:<\/p>\n<ul>\n<li><code>-f raw<\/code> tells to create raw image. The creating process is very slow, and it will take the full space you assigned (80G in my case) on host. Not-used space on the guest cannot be used on the host. For choice, you may use <code>-f qcow2<\/code> instead, which only allocates space to the image file when the guest operating system actually writes to the virtual hard disk. However, use qcow2 will likely affect performance.<\/li>\n<li><code>\/media\/ji\/600g\/windows10.raw<\/code> tells to create <code>windows10.raw<\/code> image file as virtual disk, and it&#8217;s saved to the external disk mounted on \/media\/ji\/600g. You can skip the path, so the image file will be created in current directory.<\/li>\n<li><code>80G<\/code>, the full capacity of the guest hard drive on the host.<\/li>\n<\/ul>\n<p>And, at any time, you can move or delete the file (windows10.raw in my case) as you want. Though, you need to change path to file in next commands.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/create-qemu-disk.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47660\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/create-qemu-disk-700x213.webp\" alt=\"\" width=\"610\" height=\"186\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/create-qemu-disk-700x213.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/create-qemu-disk-300x91.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/create-qemu-disk.webp 706w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p><b>2. To install virtual operating system<\/b>, use command looks like:<\/p>\n<pre>qemu-system-x86_64 -cdrom \/path\/to\/iso-image -boot menu=on -drive file=\/path\/to\/virtual-disk-image,format=raw -m 8G -cpu host -smp sockets=1,cores=2,threads=2 --enable-kvm<\/pre>\n<p>This command tells to use:<\/p>\n<ul>\n<li><code>qemu-system-x86_64<\/code> to simulate <code>amd64<\/code> guest CPU architecture. Replace <code>x86_64<\/code> with <code>x86<\/code>, <code>s390x<\/code>, <code>ppc<\/code>, etc depends on guest OS type.<\/li>\n<li><code>-cdrom \/path\/to\/iso-image<\/code> to attach <code>.iso<\/code> image via CD Rom.<\/li>\n<li><code>-boot menu=on<\/code> to show the menu to select which device to boot.<\/li>\n<li><code>file=\/path\/to\/virtual-disk-image,format=raw<\/code> to attach virtual disk via image file, replace <code>raw<\/code> according what you created in last command.<\/li>\n<li><code>-m 8G<\/code> &#8211; assign RAM memory.<\/li>\n<li><code>-cpu host<\/code> to use CPU type same to host. For choice, you may run <code>qemu-system-x86_64 -cpu help<\/code> to get more choices.<\/li>\n<li><code>-smp sockets=1,cores=2,threads=2<\/code> &#8211; set 1 CPU with 2 cores and each 2 threads, meaning (2cores\/4threads).<\/li>\n<li><code>--enable-kvm<\/code> to enable KVM. For choice, you may use <code>-accel kvm<\/code> instead.<\/li>\n<\/ul>\n<p>In my case, the command is:<\/p>\n<pre>qemu-system-x86_64 -cdrom ~\/Documents\/windows_10_enterprise_ltsc_2019_x64_dvd_9c09ff24.iso -boot menu=on -drive file=\/media\/ji\/600g\/windows10.raw,format=raw -m 8G -cpu host -smp sockets=1,cores=2,threads=2 --enable-kvm<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/qemu-install-os.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47661\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/qemu-install-os-700x444.webp\" alt=\"\" width=\"610\" height=\"387\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/qemu-install-os-700x444.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/qemu-install-os-300x190.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/qemu-install-os-768x487.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/qemu-install-os-1536x974.webp 1536w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/qemu-install-os-1320x837.webp 1320w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/qemu-install-os.webp 1556w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>The command above will launch the virtual machine window, allowing to boot from .iso image, then install the OS to the virtual disk image.<\/p>\n<p>Afterward, <b>run the guest OS<\/b> via command:<\/p>\n<pre>qemu-system-x86_64 \/path\/to\/virtual-disk-image<\/pre>\n<p>As well, you may add similar options above to specify memory size, how may CPU cores to use, enable KVM, etc. See the <a href=\"https:\/\/www.qemu.org\/docs\/master\/system\/qemu-manpage.html\" target=\"_blank\" rel=\"noopener\">official documentation<\/a> for more.<\/p>\n<h3>3. Use graphical tool to install &amp; manage QEMU\/KVM VMs<\/h3>\n<p>The QEMU command line tool is NOT convenient and hard for beginners. To make life easier, there are a few graphical tools to install &amp; manage the VMs. And, here I&#8217;m going to show you &#8220;Virtual Machine Manager&#8221;.<\/p>\n<h4>Install Virtual Machine Manager:<\/h4>\n<p>First, open terminal (Ctrl+Alt+T) and run command to install the graphical tool:<\/p>\n<pre>sudo apt install virt-manager<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/apt-virtmanager.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-47662\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/apt-virtmanager.webp\" alt=\"\" width=\"690\" height=\"441\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/apt-virtmanager.webp 690w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/apt-virtmanager-300x192.webp 300w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/a><\/p>\n<p>Then, add your user into <code>libvirt<\/code> group and start the daemon service:<\/p>\n<pre>sudo gpasswd --add $USER libvirt<\/pre>\n<pre>sudo systemctl start libvirtd<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/start-libvirtd.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47663\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/start-libvirtd-700x254.webp\" alt=\"\" width=\"610\" height=\"221\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/start-libvirtd-700x254.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/start-libvirtd-300x109.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/start-libvirtd.webp 706w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<h4>Launch the tool and create new VMs<\/h4>\n<p>Next search for and launch Virtual Machine Manager from start menu (or GNOME Overview). It should automatically connect to QEMU\/KVM system on startup.<\/p>\n<p>If NOT, just double-click on it in the list. And, <b>try restarting computer if connection failed!<\/b><\/p>\n<p>Then, click the first toolbar icon, or go to menu &#8220;File -&gt; New Virtual Machine&#8221; to start the create VM dialog.<\/p>\n<p>In the pop-up wizard, you can choose install from local .iso image, network install, existing virtual disk image, as well choose the guest OS architecture type.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/vm-manager-new.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47665\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/vm-manager-new-700x552.webp\" alt=\"\" width=\"610\" height=\"481\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/vm-manager-new-700x552.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/vm-manager-new-300x236.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/vm-manager-new-768x605.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/vm-manager-new.webp 844w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>Then follow the pop-up wizard to choose .iso image or CD Rom install media. If you clicked &#8220;Browse&#8230;&#8221; button instead of manually type path to iso image, then, you may manually add pool for non-default location, e.g., external disk, and create virtual disk there.<\/p>\n<p>Finally, click &#8220;Browse Local&#8221; and choose the .iso image. <b>NOTE: it will ask and change the file permission of selected iso image and virtual disk image. If, you don&#8217;t like this behavior, see next step.\u00a0<\/b><\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virt-manager-create.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47666\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virt-manager-create-700x498.webp\" alt=\"\" width=\"610\" height=\"434\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virt-manager-create-700x498.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virt-manager-create-300x213.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virt-manager-create-768x546.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virt-manager-create.webp 1100w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>Next, set memory size and how many CPU cores to use, create virtual disk or choose existing disk image you just created, and so forth until the wizard done.<\/p>\n<p>If everything goes well, the virtual machine should start and load the iso image for installing the operating system.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virtm-choosedisk.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-47667\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virtm-choosedisk.webp\" alt=\"\" width=\"500\" height=\"500\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virtm-choosedisk.webp 500w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virtm-choosedisk-300x300.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virtm-choosedisk-250x250.webp 250w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/a><\/p>\n<h4>Configure KVM to use as normal user<\/h4>\n<p>Creating virtual disk image in non-default location (e.g., external disk) and attaching .iso image will change the ownership of them, so they will NOT belong to you (your user). And, it may even fail sometimes due to permission issue.<\/p>\n<p>To workaround it, you may configure to use as a normal user.<\/p>\n<p>First, run the command in terminal (Ctrl+Alt+T) to edit the libvirtd config file:<\/p>\n<pre>sudo nano \/etc\/libvirt\/libvirtd.conf<\/pre>\n<p>Then, find out and set <code>unix_sock_group = 'libvirt'<\/code> and <code>unix_sock_<b>rw<\/b>_perms = '0770'<\/code> by removing # at the beginnings and change value. Finally, press Ctrl+S to save, Ctrl+X to exit.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/edit-libvirtd.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47668\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/edit-libvirtd-700x505.webp\" alt=\"\" width=\"610\" height=\"440\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/edit-libvirtd-700x505.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/edit-libvirtd-300x216.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/edit-libvirtd.webp 706w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>Next, edit qemu config file by running command:<\/p>\n<pre>sudo nano \/etc\/libvirt\/qemu.conf<\/pre>\n<p>Then find out and set <code>user = \"your_user\"<\/code> and <code>group = \"your_user\"<\/code> and save file (Ctrl+S, then Ctrl+X).<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/edit-qemu.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47669\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/edit-qemu-700x505.webp\" alt=\"\" width=\"610\" height=\"440\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/edit-qemu-700x505.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/edit-qemu-300x216.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/edit-qemu.webp 706w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>Finally, restart the daemon via command:<\/p>\n<pre>sudo systemctl restart libvirtd.service<\/pre>\n<p>Then, close and re-launch Virtual Machine Manager.<\/p>\n<h4>Create share folder between host and guest OSes<\/h4>\n<p>To share files between host and guest operating systems, you may create a share folder via the step below.<\/p>\n<p><b>1.<\/b> First, open terminal and install <code>spice-vdagent<\/code> and <code>virtiofsd<\/code> packages in both host and guest OSes:<\/p>\n<ul>\n<li>For Debian, Ubuntu, Linux Mint, etc, use command:\n<pre>sudo apt install spice-vdagent virtiofsd<\/pre>\n<\/li>\n<li>For Fedora and based systems, run:\n<pre>sudo dnf install spice-vdagent virtiofsd<\/pre>\n<\/li>\n<li>And, Arch based systems may run the command instead:\n<pre>sudo pacman -S spice-vdagent virtiofsd<\/pre>\n<\/li>\n<li>For Windows, just click download &amp; install the <a href=\"https:\/\/www.spice-space.org\/download\/windows\/spice-guest-tools\/spice-guest-tools-latest.exe\" target=\"_blank\" rel=\"noopener\">spice-guest-tools exe<\/a> file.<\/li>\n<\/ul>\n<p><b>2.<\/b> Next go to menu &#8220;View -&gt; Details&#8221; in virtual machine window. Then do:<\/p>\n<ul>\n<li>Navigate to &#8220;Memory&#8221; in left, and enable &#8220;Enable shared memory&#8221;.<\/li>\n<li>Click on &#8220;Add Hardware&#8221; button, then choose &#8220;Filesystem&#8221; in pop-up dialog.<\/li>\n<li>Next set:\n<ul>\n<li>Driver: virtiofs.<\/li>\n<li>Source path: path to the folder you want to share in the host OS.<\/li>\n<li>Target path: whatever share-name<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/add-share-folder.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47670\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/add-share-folder-700x529.webp\" alt=\"\" width=\"610\" height=\"461\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/add-share-folder-700x529.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/add-share-folder-300x227.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/add-share-folder-768x580.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/add-share-folder.webp 1147w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p><b>3.<\/b> Finally, start or restart the virtual machine.<\/p>\n<p><b>For Linux guest OS<\/b>, run command to mount the share folder that works until reboot:<\/p>\n<pre>sudo mount -t virtiofs <b>share<\/b> \/home\/USERNAME\/Documents\/share<\/pre>\n<p>Here replace <b>share<\/b> with the share-name you set in last step, as well as the mount point in guest OS to yours. When done, open that mount point folder and see if it works!<\/p>\n<p>To make it permanent, use <code>sudo nano \/etc\/fstab<\/code> command to edit <code>\/etc\/fstab<\/code> and add new line below in the end:<\/p>\n<pre>share-name-here   \/path\/to\/mount\/in\/guest  virtiofs   defaults  0   0<\/pre>\n<p>Finally, press Ctrl+S to save and Ctrl+X to exit.<br \/>\n<a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/mount-sharefolder.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47671\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/mount-sharefolder-700x526.webp\" alt=\"\" width=\"610\" height=\"458\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/mount-sharefolder-700x526.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/mount-sharefolder-300x225.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/mount-sharefolder-768x577.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/mount-sharefolder.webp 1232w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p><b>For Windows<\/b>, do following steps one by one on the guest OS:<\/p>\n<ol>\n<li>First <b>download &amp; install WinFSP<\/b> from <a href=\"https:\/\/winfsp.dev\/rel\/\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/li>\n<li>Then click <b>download <a href=\"https:\/\/fedorapeople.org\/groups\/virt\/virtio-win\/direct-downloads\/latest-virtio\/virtio-win.iso\" target=\"_blank\" rel=\"noopener\">virtio-win.iso<\/a><\/b> from Fedora website.<\/li>\n<li>Open file explorer, navigate to the Downloads folder and click <b>mount the virtio-win.iso image<\/b> you just downloaded.<\/li>\n<li>Right-click on start menu icon and open &#8220;Device Manager&#8221;, navigate to &#8220;Other Devices -&gt; Mass Storage Controller&#8221;, and right-click on it and select &#8220;Update driver&#8221;.<br \/>\n<a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/win10-update-massivedrive.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47673\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/win10-update-massivedrive-700x514.webp\" alt=\"\" width=\"610\" height=\"448\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/win10-update-massivedrive-700x514.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/win10-update-massivedrive-300x220.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/win10-update-massivedrive-768x564.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/win10-update-massivedrive.webp 793w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/li>\n<li>Next click &#8220;Browse my computer for driver software&#8221;, browse and choose the DVD Drive (you just mounted for virtio-win.iso image) as the location for drivers, finally click &#8216;Next&#8217; to automatically search and install the driver from that directory.<\/li>\n<li>Then open the DVD Drive in file explorer, and navigate to <b>viofs<\/b> folder. Next, copy either <b>w10<\/b> or <b>w11<\/b> sub-folder, depends guest OS version, to local directory, e.g., C:\\virtiofs (create <code>virtiofs<\/code> folder in C manually).<br \/>\n<a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/copy-virtofs.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47675\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/copy-virtofs-700x410.webp\" alt=\"\" width=\"610\" height=\"357\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/copy-virtofs-700x410.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/copy-virtofs-300x176.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/copy-virtofs-768x449.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/copy-virtofs.webp 834w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/li>\n<li>Finally, open <b>cmd (Command Prompt) as admin<\/b> and run commands to create and start service to auto-mount the share folder:\n<pre>sc.exe create VirtioFsSvc binpath=\"path\\to\\virtiofs.exe\" DisplayName=\"Virtio FS Service\"<\/pre>\n<pre>sc.exe start VirtioFsSvc<\/pre>\n<p>Here you need to replace <code>path\\to\\virtiofs.exe<\/code>. In my case, I copied the &#8220;w10&#8221; folder from DVD Drive to <code>C:\\virtiofs<\/code>, so the path is <code>C:\\virtiofs\\w10\\amd64\\virtiofs.exe<\/code>.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/w10-start-viofs-service.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47674\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/w10-start-viofs-service-700x311.webp\" alt=\"\" width=\"610\" height=\"271\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/w10-start-viofs-service-700x311.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/w10-start-viofs-service-300x133.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/w10-start-viofs-service-768x341.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/w10-start-viofs-service.webp 1003w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/li>\n<\/ol>\n<p>If everything goes well, you should now see the share folder in the left pane of file explorer.<\/p>\n<h3>In Addition<\/h3>\n<p>There are also many other things you may want to do for VMs in the manager, such as enable 3D acceleration by switching &#8220;Video QXL&#8221; video module to &#8220;Virtio&#8221; then checking the 3D acceleration option, then enable OpenGL in Display Spice.<br \/>\n<a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virmanager-3dacc.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47676\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virmanager-3dacc-700x446.webp\" alt=\"\" width=\"610\" height=\"389\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virmanager-3dacc-700x446.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virmanager-3dacc-300x191.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virmanager-3dacc-768x490.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virmanager-3dacc-1320x842.webp 1320w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/virmanager-3dacc.webp 1488w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>As well, there&#8217;s a good tutorial shows <a href=\"https:\/\/github.com\/bryansteiner\/gpu-passthrough-tutorial\" target=\"_blank\" rel=\"noopener\">how to enable GPU passthrough<\/a>, so your virtual machine can access GPU directly for native performance for gaming and graphics editing.<\/p>\n<p>Due to limit of tutorial length, I will not add more here. Please feel free to leave comment below.<\/p>","protected":false},"excerpt":{"rendered":"<p>This is a step by step guide shows how to install and manage virtual machines using qemu\/kvm solution in Ubuntu 24.04 or Ubuntu 26.04 LTS. KVM, Kernel-based Virtual Machine, is a module in Linux Kernel that can function as a hypervisor. It offers a high performance virtualization environment with hardware virtualization extensions, such as Intel [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":47655,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[2264,2265,863],"class_list":["post-47654","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-kvm","tag-qemu","tag-virtual-machine-manager"],"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/47654","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=47654"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/47654\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/47655"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=47654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=47654"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=47654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}