about virtualize - xieyunzi/xieyunzi.github.io GitHub Wiki
vagrant
# Using vagrant to run virtual machines with desktop environment
# https://stackoverflow.com/questions/18878117/using-vagrant-to-run-virtual-machines-with-desktop-environment
Vagrant.configure(2) do |config|
# Ubuntu
config.vm.box = "bento/ubuntu-18.04"
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = true
end
# Install xfce and virtualbox additions
config.vm.provision "shell", inline: "sudo apt-get update"
config.vm.provision "shell", inline: "sudo apt-get install -y xfce4 virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11"
config.vm.provision "shell", inline: "sudo VBoxClient --clipboard"
config.vm.provision "shell", inline: "sudo VBoxClient --draganddrop"
config.vm.provision "shell", inline: "sudo VBoxClient --display"
config.vm.provision "shell", inline: "sudo VBoxClient --checkhostversion"
config.vm.provision "shell", inline: "sudo VBoxClient --seamless"
# Permit anyone to start the GUI
config.vm.provision "shell", inline: "sudo sed -i 's/allowed_users=.*$/allowed_users=anybody/' /etc/X11/Xwrapper.config"
end
# then
# 1. start vm `vagrant up`
# 2. Login with username: vagrant, password: vagrant via the login prompt on the virtualbox GUI.
# 3. Start xfce `startx`
qemu
$ qemu-img create -f qcow2 test.img 20m
Formatting 'test.img', fmt=qcow2 size=20971520 cluster_size=65536 lazy_refcounts=off refcount_bits=16
$ qemu-img info test.img
image: test.img
file format: qcow2
virtual size: 20M (20971520 bytes)
disk size: 256K
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
refs: