Using vermin to manage your own VMs

Photo by Michael Dziedzic on Unsplash

Vermin is a smart, simple, and powerful command-line tool for Linux, Windows, and macOS. It’s designed for developers/tester and others working in IT who want a fresh VM environment with a single command. It uses VirtualBox to run the VM.

Vermin allows you to build your own images based on images already available at vermin images repository.

But what if you want to have full control over the images used by vermin, or you want to build your own image that does not exist in vermin.

In this post, we are going to take step by step tutorial and see how to create your own VM image and use it to create VMs from using vermin.

Table of Contents:

  1. Install your Linux distro
  2. Configure your distro
  3. Provision your distro using Ansible
  4. Testing
  5. Export your distro as an OVA image.
  6. Using your distro from vermin

Install your Linux distribution

In this tutorial, I will use a pre-built image of Arch Linux from, you can feel free and apply the same steps on your own distro, but since vermin support by default ubuntu and centos, I will try to use Arch Linux in this tutorial.

Go ahead and download the vdi file for the version you like, in my case it is 201905-cli.

Once downloaded, you can extract the zipped file and create a new VM from this vdi disk. you can follow steps on the oracle website.

You need to do the following configuration:

  1. Change the network settings to Bridge.
  2. Start the VM using Virtualbox, and log in using username/password: osboxes/ .

Configure your distro

You need to configure the VM so we can run ansible-playbook against it to make it vermin-ready.

  1. Obtain the IP address of the VM using ip addr command.
  2. Install ssh server on your Linux distro, and make sure you enabled and started the sshd service.
  3. You need to make sure python is installed on this distro for ansible to work.

Each Linux distro can have different setup configuration, you need to find how to install ssh server and python. I used this article to install sshd.

Provision your distro using Ansible

In this step, we will use an ansible playbook defined here to make your VM a vermin-image ready.

Besides Ansible should be installed on your host machine, you need to install sshpass command and python passlib package.

sshpass command needed when login to your VM using username/password, and passlib package needed to hash the password in the Ansible playbook.

You will need to figure out how to install sshpass on your host machine, for passlib you can use pip as follow:

$ pip install passlib

Now Download the Ansible playbook to a local path on the host machine and issue the following command:

$ ansible-playbook -i, -e ansible_user=osboxes -e -e --ssh-common-args "-o StrictHostKeyChecking=no" /path/to/playbook.yaml

Note: is the IP address obtained from the second step above, and /path/to/playbook.yaml is the path to the playbook file you just downloaded.

Now Ansible will start to configure your VM and make it a valid to be converted to a vermin image.


After Ansible finishes, let’s test the VM:

Now try to login using the newly created vermin user.

$ ssh -i ~/.vermin/vermin_rsa vermin@

Note: is the IP address obtained from the second step above, and ~/.vermin/vermin_rsa file is being downloaded as part of vermin installation process.

If everything goes well, you will able to connect to your VM, and you will the terminal changed as follows:

[vermin@verminbox ~]$

Export your distro as an OVA image

By now, all done. we just need to export the VM as an OVA image and put it under a special path to be used by vermin.

First, stop the VM. then go and export it as OVA file.

Now, Copy the generated ova file to the directory: ~/.vermin/images/DISTRO/VERSION.ova
In my case, it is ~/.vermin/images/archlinux/201905.ova

To make sure vermin can now see the image, type:

$ vermin imagesIMAGE NAME               CACHED              DISK
archlinux/201905 true 1.0GB
centos/8 true 0.8GB
ubuntu/focal true 1.1GB

Notice, the image I just exported and copied is now part of vermin images.

Using your distro from vermin

Now you can feel free to create as many VMs as you need from the archlinux/201905 image:

$ vermin create archlinux/201905✔ Creating vm_05 from image archlinux/201905
✔ Setting bridged network adapter
✔ Starting vm_05
✔ Establishing connection
VM is ready, to connect to it use:
$ vermin ssh vm_05

Once you have done, you can go ahead and remove the VM you initially created inside VM based on the downloaded vdi file just to save disk space.

That’s all, if you like vermin, don’t forget to start the project page at Github.

Software Developer/Architect