Cloud Resource
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Install

Install KVM/Libvirt pkg for Ubuntu 22.04

apt install -y qemu-kvm libvirt-daemon-system \
virtinst libvirt-clients virt-top bridge-utils cloud-image-utils \
gnupg2 wget curl apt-transport-https chrony git

Add user to kvm group

sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER

Generating public/private rsa key pair

ssh-keygen

Copy public key to other kvm hosts for remote virsh cmd

ssh-copy-id user@host-01
ssh-copy-id user@host-02
ssh-copy-id user@host-03

Setup Libvirt network

Remove default network

virsh net-list --all
virsh net-destroy --network default
virsh net-undefine --network default

Creat network xml (bridge.xml) for br0 interface

cat <<EOF |tee bridge.xml
<network>
  <name>bridge</name>
  <forward mode="bridge"/>
  <bridge name="br0"/>
</network>
EOF

Define networ for libvirt

virsh net-define bridge.xml
virsh net-start --network bridge
virsh net-autostart bridge
virsh net-list

Readey for next step, create first VM ;)