aboutsummaryrefslogtreecommitdiff
path: root/content/post/install-virt-manager-in-debian.md
blob: 6676f60bd8dc3ebcc58a2a56903718b76ac21abe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
title: "Install Virt Manager in Debian"
date: 2022-04-18T13:39:50Z
lastmod: 2022-04-18T13:39:50Z
draft: false
keywords: [virt-manager kvm libvirt qemu]
description: ""
tags: [libvirt]
categories: [linux]
author: ""

# You can also close(false) or open(true) something for this content.
# P.S. comment can only be closed
comment: false
toc: true
autoCollapseToc: true
postMetaInFooter: true
hiddenFromHomePage: false
# You can also define another contentCopyright. e.g. contentCopyright: "This is another copyright."
contentCopyright: false
reward: false
mathjax: false
mathjaxEnableSingleDollar: false
mathjaxEnableAutoNumber: false

# You unlisted posts you might want not want the header or footer to show
hideHeaderAndFooter: false

# You can enable or disable out-of-date content warning for individual post.
# Comment this out to use the global config.
#enableOutdatedInfoWarning: false

flowchartDiagrams:
  enable: false
  options: ""

sequenceDiagrams: 
  enable: false
  options: ""

---

`virt-manager` or *Virtual Machine Manager* is a frontend for managing virtual machines through *libvirt*. It primarily targets KVM virtual machines but is also capable of managing Xen and LXC. In this post we will focus on KVM.

<!--more-->

*All commands in this post are supposed to be run as root.*

## Installing necessary tools
We will install libvirt, QEMU and a spice client.

```bash
apt-get --no-install-recommends install qemu-utils qemu-kvm virt-manager libvirt-clients libvirt-daemon-system virtinst bridge-utils gir1.2-spiceclientglib-2.0 gir1.2-spiceclientgtk-3.0 virt-viewer libosinfo-bin
```

## Setting up libvirt
### Set up networking
libvirt ships with a default network profile. Here we enable it have it start automatically. This will allow the virtual machines to connect to the internet.

```bash
virsh net-start default
virsh net-autostart default
```

### Add yourself to necessary groups
Here you will add yourself to the necessary groups to avoid running as root every time you want to run a virtual machine. Replace `<user>` with normal user.

```bash
adduser <user> libvirt
adduser <user> libvirt-qemu
adduser <user> kvm
```

### Enable and start libvirt
Apt automatically enables and starts `libvirtd.service`. We do it again anyways.

```bash
systemctl enable libvirtd.service
systemctl restart libvirtd.service
```

Now you should be able to install and manage virtual machines through virt-manager.