1. Install virt-manager
First you need to install it virt-manager
, the installation command is as follows.
imaginemiracle@:~$ sudo apt-get install virt-manager
After the installation is complete, check whether the installation was successful
imaginemiracle@:Ubuntu_Download$ virt-manager --version
2.2.1
After installation virt-manager
, you need to install several other related libraries and tools. The installation commands are as follows.
imaginemiracle@:~$ sudo apt-get install qemu-kvm libvirt libvirt-daemon-system libvirt-clients qemu-system
Enablelibvirtd
imaginemiracle@:~$ systemctl enable --now libvirtd
2. Download the Linux image file
Here the author is using the files Ubuntu20.10.iso
used in this article ISO
or downloading Ubuntu
other versions, which can be downloaded here https://releases.ubuntu.com/20.10/
3. Generate qcow2
the image and install the system
<1>.Open firstvirt-manager
# 用命令打开或者在应用列表中打开
imaginemiracle@:~$ sudo virt-manager
<2> .Select in turnFile -> New Virtual Machine -> Local install media
<3>. Select the downloaded ISO
system image
Here, select the image downloaded locally
and select the corresponding system type. If the system used does not have a corresponding version, just select the highest version supported by the software.
As shown in the picture, my system here Ubuntu20.10
does not have this version in the optional list. Select the highest supported version.Ubuntu20.04
<4> .Set the system memory and core number
<5> .Set the virtual machine disk size
<6>. Confirm the completion of settings
<7>. Start installing the system
The steps are the same as normal Ubuntu
system installation.
<8>. Installation completed
Entering the installed system ubuntu
is the same as normal.
<9>. Get qcow2
files
The path of the file will be given in the confirmation installation in the above steps qcow2
. If it is the default, the file will be generated in the following path. ( 注: qcow2文件是生成的虚拟机镜像文件,该文件可以被qemu、virt-manager等虚拟机服务软件直接打开
)
imaginemiracle:pool$ pwd
/var/lib/libvirt/images/pool
imaginemiracle:pool$ sudo ls -lh
total 8.1G
-rw------- 1 libvirt-qemu kvm 11G 6月 29 16:57 ubuntu20.04.qcow2
#Attachment: virt-manager
Related FAQs
Error 1:Error: No active connection to install on.
This is because libvirtd
the service is not started.
solution
imaginemiracle@:~$ sudo service libvirtd start
Error 2:libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
If libvirtd
the service has been started, you only need to modify the file permissions /var/run/libvirt/
under the directory libvirt-sock
to777
imaginemiracle@:~$ sudo chmod 777 /var/run/libvirt/libvirt-sock
Error 3:Error: Host does not support any virtualization options
There are various reasons for this error, here are some typical reasons and solutions.
1.BIOS
This error occurs because the device does not support virtualization in the device .
Solution: Restart the system and enter BIOS
the settings, and enable virtualization support.
2. Due to /dev/kvm
permission issues.
Solution: Modify /dev/kvm
permissions and owner
imaginemiracle@:~$ sudo chmod 0660 /dev/kvm
imaginemiracle@:~$ sudo chown root:kvm /dev/kvm
3. There may be libvirtd
a problem with the service startup.
Solution: Check libvirtd
the status of the service
imaginemiracle@:~$ service libvirtd status
Check whether there is an error report, and solve it one by one according to the error report.