• Submit Ticket
  • Client Login
  • Knowledgebase
CALL OUR SUPPORT 24/7 +880 1400 88 34 00
13 Jun 2020

How to install KVM for Virtualization in LinuxMint

This article shows you, how to install KVM in Linux Mint for Virtualization

Contents:

1. Install qemu-kvm and libvirt
2. Add user to libvirt group
3. Remote access via SSH
4. Add a pool for ISO file

—————————

1. Install qemu-kvm and libvirt

Use the following command to install qemu-kvm package and some packages for virtual machine operation.

$ sudo apt install -y -o 'apt::install-recommends=true' \
  qemu-kvm libvirt0 libvirt-bin virt-manager libguestfs-tools

2. Add user to libvirt group

This command for the user in libvirt group can run virt-manager and virsh without sudo.

$ sudo gpasswd libvirt -a <username>
$ sudo reboot

3. Remote access via SSH

Following command for virt-manager and virsh provdes remote access via SSH. If you want to use SSH public key authentication, you can omit inputting password.

Create SSH keys on client, which use remote access via SSH.

$ ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ""
Generating public/private rsa key pair.
Your identification has been saved in /home/idatahost/.ssh/id_rsa.
Your public key has been saved in /home/idatahost/.ssh/id_rsa.pub.
<snip>
$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB... username@clientname

Now add SSH public key entry to ~/.ssh/authorized_keys on server which is installed KVM.

$ cat ~/.ssh/authorized_keys
ssh-rsa AAAAB... username@clientname

Now specify server URI with -c option on client.

$ virsh -c qemu+ssh://username@servername/system

Setting server URI to VIRSH_DEFAULT_CONNECT_URI is equal with specifying server URI with -c option. Write VIRSH_DEFAULT_CONNECT_URI settings in your .bashrc if you need.

$ export VIRSH_DEFAULT_CONNECT_URI=qemu+ssh://username@servername/system
$ virsh

4. Add a pool for ISO file

Create ISO directory and define as pool.

$ sudo mkdir /var/lib/libvirt/isos
$ virsh pool-define-as isos dir - - - - /var/lib/libvirt/isos
$ virsh pool-autostart isos
$ virsh pool-start isos
iDATA HOST. All rights reserved
Top