This project explores using libvirt based tools to create QEMU/KVM Virtual Machine (VM) with workflow inspired by Vagrant.
Intention is to create VM from cloud disk image provided by GNU/Linux distribution and for basic initialization use cloud-init.
Note
The project is developed on Debian 12 if you use another distribution have that in mind if something doesn't work as expected.
🦈
- GNU/Linux OS capable of running QEMU/KVM based VMs.
- Simple and easy to adapt.
- Practice suckless.org philosophy, if possible.
- Support basic workflow, for everything else there is Vagrant.
- Minimal third party dependencies.
- No compiler or runtime.
Check compatibility:
grep -o 'vmx\|svm' /proc/cpuinfo # If nothing comes back check BIOS/UEFI to make sure virtualization is enabled
Install and setup on Debian/Ubuntu:
sudo apt-get install virt-manager sshpass rsync inotify-tools
sudo adduser <USER_NAME> libvirt # Add user to `libvirt` group
sudo adduser <USER_NAME> libvirt-qemu
Download Debian genericcloud image for version you wish to use in VM, e.g. https://cdimage.debian.org/images/cloud/bookworm/20241004-1890/debian-12-genericcloud-amd64-20241004-1890.qcow2.
You can also try using cloud image of another distribution if you wish.
Copy ./shark, after reviewing the code, to your echo $PATH and set execute permission on it with:
chmod +x shark
To create VM config files, most notably Sharkfile which defines VM, execute:
mkdir shark-test
cd shark-test
shark init
./example_vm_configuration_generated_with_init_action directory contains example of VM configuration generated with shark init command.
You must edit Sharkfile and user-data before creating VM with command:
shark up
To shutdown VM:
shark down
To destroy VM and its storage:
shark destroy
To print information about VM:
shark info
To establish SSH connection to VM:
shark ssh
To rsync folder ./sync_to_vm from host to VM:
shark rsync
To auto sync folder from host to VM:
shark async