Need: QCOW2 image for orchestrating Debian 11 Server image with following customizations
1. Minimal server installation + MATE Desktop Environment + xRDP + Firefox
2. ‘apparmor’ disabled
3. Install required packages – zip, unzip, net-tools, cloud-guest-utils, sudo
4. Configure max number of open files and processes to 65536
5. SSH access to be enabled only from two specific subnets (private networks)
6. Custom resizedisk script which will be triggered on first boot to resize the disk to user allocated size.
7. Create a user account with the name ‘user’ and add it to the sudo group
8. Set password for ‘user’ and ‘root’ account to a predefined standard password.
While creating this VM the disk allocated will be 2G (headless service) or 4G (with the desktop environment). However users will launch VMs with bigger disk sizes, the script is expected to update the partition table information and resize the file system.
# apt install mate-desktop-environment lightdm xrdp firefox-esr -y
Clear history, shut down, and save the VM image as base qcow2 image for Debian 11 Mate.
# cp /var/lib/libvirt/images/debian11mate.qcow2 /opt/kvmmanager/images/debian/debian11mate.qcow2
Launch a new VM. The scripts used are detailed here.
# launchvm -i 10.0.2.12/16 -h test -s 50G -f small -g 10.0.0.1 -o debian -v 11mate -d datachronicles.net -b br3
Flavor specified : small. vCPUs = 4, RAM = 12288 MB
-----------------------------------------------------------------------------------------
Processing : test.
Status : running
Domain 'test' destroyed
Domain 'test' has been undefined
Formatting '/var/lib/libvirt/images/test/instance.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=5368709120 backing_file=/var/lib/libvirt/images/test/debian11mate.qcow2 backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 Image resized.
[ 0.0] Examining the guest ...
[ 4.7] Setting a random seed
[ 4.7] Copying: /opt/kvmmanager/templates/test/interfaces to /etc/network
[ 4.7] Setting the hostname: test.datachronicles.net
[ 6.3] Setting the timezone: Asia/Kolkata
[ 6.4] Installing firstboot command: /usr/local/bin/resizedisk
[ 7.3] Finishing off Starting install... Domain creation completed. Domain 'test' marked as autostarted
Test RDP
Start firefox browser
Logout