如何在CentOS8上使用Multipass

警告
本文最后更新于 2021-12-13,文中内容可能已过时。

Using libvirt in Multipass 在CentOS8没有成功,使用了 lxd

1
2
3
4
5
6
dnf install cockpit cockpit-machines -y
systemctl start cockpit.socket
systemctl enable cockpit.socket
systemctl status cockpit.socket
firewall-cmd --add-service=cockpit --permanent
firewall-cmd --reload

要访问 Cockpit Web 控制台,请打开 Web 浏览器并使用以下 URL

1
2
3
https://FQDN:9090/
OR
https://SERVER_IP:9090/

https://i.imgur.com/seirrNb.png

确认硬件平台支持虚拟化

1
2
grep -e 'vmx' /proc/cpuinfo		#Intel systems
grep -e 'svm' /proc/cpuinfo		#AMD systems

确认 KVM 模块已加载到内核中(默认情况已加载)

1
2
3
4
$ sudo lsmod | grep kvm
kvm_intel             303104  0
kvm                   798720  1 kvm_intel
irqbypass              16384  1 kvm
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
dnf module install virt
dnf install virt-install virt-viewer

# 运行 virt-host-validate 命令来验证主机是否设置为运行 libvirt 管理程序驱动程序。
virt-host-validate

# 开启
systemctl start libvirtd.service
systemctl enable libvirtd.service
systemctl status libvirtd.service
1
2
3
4
5
6
7
dnf install epel-release
dnf upgrade

yum install snapd
systemctl enable --now snapd.socket
snap install multipass lxd
multipass set local.driver=lxd

开启一个ubuntu的虚拟机

1
2
# 启动一个名为ubuntu-0的虚拟机
multipass launch -c 2 -m 4G -d 20G --network name=bridge0 -n k8s-node2 lts

Installing snap on CentOS

How to Install KVM on CentOS/RHEL 8

3 Ways to Create a Network Bridge in RHEL/CentOS 8

How can I redirect storage of Multipass VMs?

Moving the data directory of Multipass and Docker