How to Set Up and Use KVM on Manjaro Linux

Manjaro Linux is a powerful and user-friendly Arch-based distribution that supports Kernel-based Virtual Machine (KVM) for virtualization. KVM allows users to run multiple virtual machines efficiently with near-native performance. Whether you’re a developer, tester, or just experimenting with different operating systems, KVM on Manjaro is an excellent choice.

Here’s a step-by-step guide on how to install, configure, and manage KVM on Manjaro Linux.

Step 1: Check if Your System Supports KVM

Before installing KVM, verify if your system supports virtualization.

  1. Open a terminal and run: lscpu | grep Virtualization If the output includes VT-x (Intel) or AMD-V (AMD), your CPU supports virtualization.
  2. Ensure virtualization is enabled in your BIOS/UEFI settings.

Step 2: Install KVM and Required Packages

Install KVM and essential dependencies by running:

sudo pacman -S qemu virt-manager virt-viewer dnsmasq vde2 bridge-utils libvirt

These packages include:

  • qemu: Open-source machine emulator and virtualizer.
  • virt-manager: GUI tool for managing virtual machines.
  • libvirt: Toolkit for managing KVM instances.

Step 3: Enable and Start Services

Once installed, enable and start the necessary services:

sudo systemctl enable --now libvirtd.service
sudo systemctl start libvirtd.service

Check the status with:

systemctl status libvirtd.service

Step 4: Add User to the Libvirt Group

To manage virtual machines without root privileges, add yourself to the libvirt group:

sudo usermod -aG libvirt $(whoami)

Then restart your session:

newgrp libvirt

Step 5: Verify KVM Installation

Run the following command to confirm KVM is set up correctly:

virsh list --all

If everything is set up properly, you should see an output without errors.

Step 6: Create and Manage Virtual Machines

Using Virt-Manager (GUI Method)

  1. Launch Virt-Manager: virt-manager
  2. Click Create a new virtual machine.
  3. Choose an ISO file or network installation.
  4. Assign CPU cores and RAM.
  5. Create a virtual disk and complete the setup.
  6. Start the virtual machine and install the OS.

Using CLI (Command-Line Method)

For advanced users, virtual machines can be created using the terminal:

virt-install \
  --name myVM \
  --vcpus 2 \
  --memory 4096 \
  --cdrom /path/to/iso \
  --disk size=20 \
  --os-variant generic

Step 7: Managing KVM Networks

To check network status, run:

virsh net-list --all

To start the default network:

sudo virsh net-start default
sudo virsh net-autostart default

Conclusion

Setting up KVM on Manjaro Linux provides a robust, high-performance virtualization solution. Whether using Virt-Manager for an intuitive experience or the command line for precise control, KVM offers flexibility for all types of users.

Have you tried KVM on Manjaro? Let’s discuss your experience and any challenges you faced!

1 thought on “How to Set Up and Use KVM on Manjaro Linux”

Leave a Comment