====== vms ======

An example using vms for creating and managing a qemu virtual machine

===== Installation =====

You need to install vde2, tigervnc and qemu first

Get the ready made package, you should use the latest release

<code bash>
wget https://bitbucket.org/yotis/vms/vms-0.2.0-noarch-1did.tgz
</code>

Install or upgrade vms with

<code>
upgradepkg --install-new vms-0.2.0-noarch-1did.tgz
</code>

===== Creating vm1 =====

Create the vm1 virtual machine and show the related configuration
and files

<code bash>
vms create vm1
vms list
grep vm1 ~/.vms/vms.conf
ls ~/.vms/vm1
</code>

You can use the ~/.vms/vm1 directory to store anything you want, but
this is not mandatory. The only thing that is needed is the
~/.vms/vm1.sh script.

To show the configuration for the vm1 virtual machine, use this

<code bash>
vms info vm1
</code>

You should be able to start vm1 now with

<code bash>
vms start vm1
</code>

To display the running status of vm1 use this

<code bash>
vms status vm1
</code>

If you want to kill vm1, you can do it like this

<code bash>
vms kill vm1
</code>

Now, add 2GB of memory
<code bash>
vms conf vm1 mem 2048
</code>

Let's create a 20G disk and attach it to vm1

<code bash>
cd ~/.vms/vm1
qemu-img create -f qcow2 disk0.img 20G
vms conf vm1 disk0 '~/.vms/vm1/disk0.img'
</code>

And now, let's add a cdrom and boot from it. If there is a slackware
install dvd located in ~/os

<code bash>
vms conf vm1 bootcd ~/os/slackware64-14.2-install-dvd.iso
vms info vm1
</code>

Even though you can edit vm1's configuration via
<code bash>vms conf</code> commands, you are encouraged to edit
~/.vms/vms.conf by hand. The format is very simple and since this file
is sourced during vms execution you can be creative with bash
variables. For example, you could configure shared storage for the os
images by declaring a variable at the beginning of ~/.vms/vms.conf.

<code bash>
ISOS=/path/to/isos
</code>

Then you would use the ISOS variable via 'vms conf' like this

<code bash>
vms conf vm1 bootcd '"$ISOS/slackware64-14.2-install-dvd.iso"'
</code>

Notice the use of single and double quotes.

===== Sources =====

  * Nikos Giotis

{{tag>vms qemu}}

https://docs.slackware.com/howtos:emulators:vms-HOW-TO