Skip to content

Home Lab

Notes from my learning sessions

Menu
Menu

Preparing custom Debian 11 MATE image

Posted on March 6, 2022March 7, 2022 by sandeep

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

Recent Posts

  • Ceph + KVM: 4. Orchestrating Ceph RBD backed VMs on KVM Hosts
  • Rabbit MQ Cluster + HAProxy + Keepalived
  • Install and configure MariaDB / Galera cluster
  • Ceph + KVM : 3. Installing KVM, cutsomized monitoring scripts
  • Ceph + KVM : 5. Service checks and CLI commands
  • Ceph + KVM : 2. Installation – Ceph Storage
  • Ceph + KVM : 1. Planning and preparing for Ceph Storage
  • Openstack Xena on Ubuntu 20.04 – Cinder
  • Preparing custom Debian 11 MATE image
  • Setup Ubuntu 20.04 repository mirror server

Archives

  • April 2025
  • March 2025
  • October 2024
  • September 2024
  • April 2022
  • March 2022
  • February 2022
  • December 2021
  • October 2021
  • September 2021
  • October 2020
  • February 2020
  • January 2020
  • December 2019
© 2025 Home Lab | Powered by Minimalist Blog WordPress Theme