- Example showing how to create a thin qcow2 disk
qemu-img create -f qcow2 VOLUME_NAME.qcow2 VOLUME_SIZE_GB
- Example showing how to create a qcow2 disk with backing volume
qemu-img create -f qcow2 -F qcow2 -b BACKING_VOLUME.qcow2 NEW_VOLUME_NAME.qcow2
- Example controller vm. no special setup
virt-install -n os-controller --os-type Linux --os-variant ubuntu20.04 --ram 8192 --vcpus 2 --import --disk /data/images/os-controller.qcow2 --network bridge:br-mgt --graphics vnc --noautoconsole
- Example compute vm. host cpu passthrough for nested kvm and tenant network
virt-install -n os-compute --os-type Linux --os-variant ubuntu20.04 --ram 16384 --vcpus 2 --cpu host-passthrough --import --disk /data/images/os-compute.qcow2 --network bridge:br-mgt --network bridge:br-tnt --graphics vnc --noautoconsole
- Example network vm. tenant and provider networks
virt-install -n os-network --os-type Linux --os-variant ubuntu20.04 --ram 2048 --vcpus 1 --import --disk /data/images/os-network.qcow2 --network bridge:br-mgt --network bridge:br-tnt --network bridge:br-ext --graphics vnc --noautoconsole
- Example ceph, block, or object vms. multiple disks
virt-install --name os-ceph --os-type Linux --os-variant centos7.0 --ram 4096 --vcpus 1 --import --disk /data/images/os-ceph.qcow2 --disk /data/disks/os-ceph-data1.qcow2 --disk /data/disks/os-ceph-data2.qcow2 --disk /data/disks/os-ceph-data3.qcow2 --disk /data/disks/os-ceph-data4.qcow2 --network bridge:br0 --graphics vnc --noautoconsole
touch /etc/cloud/cloud-init.disabled
- Add the following to /etc/default/grub:
GRUB_CMDLINE_LINUX="console=ttyS0"
- Rebuild grub:
- Set host name
hostnamectl set-hostname HOSTNAME
- Set hosts file
sed -i 's/OLDHOSTNAME/NEWHOSTNAME/g' /etc/hosts
- Set up network (refer to netplan samples)
vi /etc/netplan/00-installer-config.yaml
netplan apply
- Set up timezone
timedatectl set-timezone TIMEZONE
- Install NTP
- Disable AppArmor
systemctl disable apparmor
- Disable ufw (firewall)
- Reboot guest
- Simple netplan example for one interface on management network
network:
ethernets:
enp1s0:
addresses:
- 10.10.10.11/24
gateway4: 10.10.10.1
nameservers:
addresses:
- 8.8.8.8
search: []
version: 2
- More complex example showing two networks. Note that some trickery needed to avoid duplicate default routes
network:
ethernets:
enp1s0:
addresses:
- 10.10.10.11/24
gateway4: 10.10.10.1
nameservers:
addresses:
- 8.8.8.8
search: []
enp2s0:
addresses:
- 10.10.20.11/24
routes:
- to: 10.10.20.0/24
via: 10.10.20.1
metric: 500
table: 1
routing-policy:
- from: 10.10.20.11
table: 1
version: 2
- Even more complex example showing three networks, one of which has no address. Note that some trickery needed to avoid duplicate default routes and a quick trick to have an interface with no config.
network:
ethernets:
enp1s0:
addresses:
- 10.10.10.11/24
gateway4: 10.10.10.1
nameservers:
addresses:
- 8.8.8.8
search: []
enp2s0:
addresses:
- 10.10.20.11/24
routes:
- to: 10.10.20.0/24
via: 10.10.20.1
metric: 500
table: 1
routing-policy:
- from: 10.10.20.11
table: 1
enp3s0: {}
version: 2