6

Linux 安装 KVM 虚拟机

 2 years ago
source link: https://segmentfault.com/a/1190000040889076
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

在 Archlinux 中安装

sudo pacman -Sy qemu libvirt ebtables dnsmasq bridge-utils virt-manager
  • kvm 负责 CPU 和内存的虚拟化
  • qemu 向 Guest OS 模拟硬件(例如,CPU,网卡,磁盘,等)
  • ovmf 为虚拟机启用UEFI支持
  • libvirt 提供管理虚拟机和其它虚拟化功能的工具和 API
  • virt-manager 是管理虚拟机的 GUI

开启 libvirt 服务

sudo systemctl enable libvirtd
sudo systemctl start libvirtd

将当前用户加入 KVM 用户组

sudo usermod -a -G kvm $USER

参考:

在Ubuntu 中安装

检查 CPU 是否支持虚拟化

egrep -c '(vmx|svm)' /proc/cpuinfo

检查系统是否支持 kvm 加速

sudo kvm-ok

安装 CPU 检查器

sudo apt install cpu-checker

重启电脑后开始安装 KVM

sudo apt update
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils

将当前登录用户添加到名为 libvirt 和 KVM 的组中。

sudo adduser `id -un` libvirt

查看当前登录用户是哪些组的成员

sudo grep `id -un` /etc/group
sudo virsh list --all

检查运行状态

sudo systemctl status libvirtd

安装 KVM 的 GUI 管理工具(Server 不需要)

sudo apt install virt-manager

default 网卡未启动:

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

文章首发于我的博客:https://b.catch-e.space/2021/...


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK