A toolkit for provisioning standardized Linux virtual machines in VirtualBox, designed to create consistent testing environments. This repository contains scripts to automate the setup of Ubuntu/Debian-based VMs with VirtualBox Guest Additions, user configuration, and desktop environment settings.
- provision-vm
This toolkit provides three scripts that work together to create a fully configured Linux VM:
- provision-this-vm.sh - Run inside the VM as root to install Guest Additions and create a demo user
- provision-this-user.sh - Run inside the VM as the user to configure desktop settings
- provision-vm-guest.py - Run on the host to enable clipboard sharing and create a snapshot
- VirtualBox installed (tested with VirtualBox 6.x/7.x)
- Python 3.x (for the host configuration script)
- Windows, macOS, or Linux host OS
- Debian 12 tested as Guest
- Guest using KDE Plasma desktop environment to support desktop config
- VirtualBox Guest Additions ISO attached to the VM
-
Clone this repository or download the scripts to both your host machine and the VM:
git clone <repository-url> cd provision-vm
-
Copy
provision-this-vm.shandprovision-this-user.shto the VM using shared folders or SCP -
Ensure scripts are executable:
chmod +x provision-this-vm.sh chmod +x provision-this-user.sh chmod +x provision-vm-guest.py
- Start your VM and log in
- Insert the VirtualBox Guest Additions ISO:
- In VirtualBox menu: Devices → Insert Guest Additions CD image...
- Open a terminal and navigate to the script location
- Create a
.envfile if you need to set a custom user in addition to demo (optional). Entry would beUSER1=custom_user - Run the provisioning script as root:
sudo ./provision-this-vm.sh
- You'll be prompted to create a password for the 'demo' user if it doesn't exist
- The script will install necessary packages and Guest Additions
- Log out and log back in as each user whose settings you want to configure (e.g., 'demo' and/or custom_user)
- Run the user configuration script:
./provision-this-user.sh
- This disables screen locking and configures KDE to use double-click instead of single-click
- Shut down the VM
- On your host machine, run the Python script:
python provision-vm-guest.py
- Select your VM from the list
- The script will enable bidirectional clipboard and create a snapshot
- Creates a 'demo' user with sudo privileges (if not exists)
- Enables passwordless sudo for the demo user and custom_user if enabled
- Installs and configures time synchronization
- Installs VirtualBox Guest Additions with required dependencies
- Cleans up the system
- Disables KDE screen locking and screensaver
- Changes folder behavior from single-click to double-click
- Must be run as the target user (not root)
- Lists all VirtualBox VMs on the host
- Enables bidirectional clipboard sharing
- Creates a "fully-provisioned" snapshot for easy restoration
- Username:
demo - Privileges: Full sudo access without password
- Shell:
/bin/bash
- Privileges: Full sudo access without password
Available for demo and custom_user
- Screen locking: Disabled
- Auto-lock on idle: Disabled
- Lock on resume: Disabled
- Folder interaction: Double-click to open
- Guest Additions: Installed
- Clipboard: Bidirectional
- Snapshot: "fully-provisioned" created after setup
- Ensure the Guest Additions ISO is properly inserted
- Check that
/dev/cdromcontains the ISO:blkid /dev/cdrom - Verify kernel headers match running kernel:
uname -r
- Check file permissions:
ls -la provision-*.sh - Ensure line endings are Unix-style (LF, not CRLF)
- Log out and log back in after running
provision-this-user.sh - Verify you're running KDE:
echo $XDG_CURRENT_DESKTOP
- The Python script automatically adds VirtualBox to PATH
- If issues persist, add VirtualBox to your system PATH manually
- Custom users can be added by creating a
.envfile withUSER1=custom_user - The
.envfile is sourced byprovision-this-vm.sh