====== Using vms command line tool to create and manage a qemu virtual machine ====== ===== 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 and install it, you should use the latest release wget https://bitbucket.org/yotis/vms/vms-0.2.1-noarch-1did.tgz upgradepkg --install-new vms-0.2.1-noarch-1did.tgz Or use slackbuilds.org, eg via sbopkg sbopkg -i vms ===== Creating vm1 ===== Create the vm1 virtual machine and show the related configuration and files vms create vm1 vms list grep vm1 ~/.vms/vms.conf ls ~/.vms/vm1 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/vm1.sh script. To show the configuration of the vm1 virtual machine, use this vms info vm1 You should be able to start vm1 now with vms start vm1 To display the running status of vm1 use this vms status vm1 If you want to kill vm1, you can do it like this vms kill vm1 Now, add 2GB of memory vms conf vm1 mem 2048 Let's create a 20G disk and attach it to vm1 cd ~/.vms/vm1 qemu-img create -f qcow2 disk0.img 20G vms conf vm1 disk0 '~/.vms/vm1/disk0.img' And now, let's add a cdrom and boot from it. If there is a slackware install dvd located in ~/os vms conf vm1 bootcd ~/os/slackware64-14.2-install-dvd.iso vms info vm1 Even though you can edit vm1's configuration via vms conf 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. ISOS=/path/to/isos Then you would use the ISOS variable via 'vms conf' like this vms conf vm1 bootcd '"$ISOS/slackware64-14.2-install-dvd.iso"' Notice the use of single and double quotes. ===== Sources ===== * Nikos Giotis {{tag>howtos software emulator vms qemu needs_attention}}