Step-by-Step Guide
Following are the steps involved for enabling the qemu guest agent which involves the installation of qemu, kvm and libvirt as well in case you don’t have it in your system.
Step 1: Updating your Repository
Before any installation we need to update our repository and for that execute the below command:
Step 2: Installing Qemu and libvirt
Now we need to have Qemu and libvirt on our system, for that execute the below command:
Step 3: Installing virt-manager
Next thing we need is to download the virtual manager in which we’ll create our virtual device, so execute the below command for the installation:
Step 4: Creating directory
Now after this we need to create a directory and for that execute the below command:
After creating the directory we need to change the owner, so execute the below command in your terminal:
Step 5: Changes in the libvirt file
Open the below file using the command provided:
This will open a file in which you’ve to add the given lines at the end and save the file:
Step 6: Installing Qemu Guest Agent
Now we will install the guest agent on our system so for that execute the below command provided:
This will successfully install qemu guest agent on your system.
Step 7: Creating Virtual Device
After installing the agent we need to create a virtual device on the virtual manager, so open the virtual manager and create a device.
Here we’ve created a Ubuntu 20.04 virtual device using the ISO file, and name it “ubuntu20.04”, you can name it according to your choice but remember the name as we’ve to use it later.
Step 8: Virtual Terminal
Now we’ll enter the virtual device terminal by executing the below command:
Here we need to edit our virtual device so execute the below command and replace ubuntu20.04 with the name of your virtual machine:
Here, you’ll be provided with various option so select the 1 option which will open a file in which you’ve to paste the following lines:
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
After pasting the lines simply save the file and following message will be displayed:
Now, restart you virtual machine and execute the below lines in your virsh terminal which will provide you the IP address:
This was all for enabling the qemu guest agent on your systems.
Conclusion
Qemu guest agent helps the user exchange the information between host and guest, and acts like a helper daemon. In this article we guided you how to enable the qemu guest agent on your systems, also we provided you commands for the installation of qemu-kvm, libvirt and virt-manager which were pre-required for enabling the qemu agent. We also created a virtual device using the iso file and enabled the qemu agent to share ip addresses between host and guest.