=====Creating Virtual Machines=====
This project will have you setting up virtual machines that can be used for experimentation and other projects.
====Prerequisites====
To do this project, you will need to have successfully completed:
* [[hpc0/projects/vm_server_install|Linux VM Server Install]]
====Ingredients====
You will need:
* available VMserver that can host your virtual machine
* an allocated VM that nobody else has claimed
====Background====
Following your setup of a VM server, the next logical step is to do something with it; creating and running virtual machines allows you to have network-accessible machines that you can set up various services, just as if they were a real machine.
Host names: vm##.student.lab (01-32)
MAC address: 00:16:3e:2e:c0:##
For vm01, ## would be "01"
For vm10, ## would be "0a" (they're in hex).
For vm32, ## would be "20" (0x20 = 32).
====Allocating the VM====
* Log into the VM server (as root)
* Check number of running virtual machines: xm list (if there are already 8 VMs running, use a different VM server)
* Reference [[lab46>notes:hpc0]] and claim an open VM (edit the table and put in your information)
====Creating the VM====
* Create the VM (on the vmserver)
Be sure to substitute to your VM's two digit number in place of ## below.
vmserver:~# xen-create-image --hostname=vm## --mac=00:16:3e:2e:c0:## --role=udev
If you have no errors in your /etc/xen/xend-config.sxp and /etc/xen-tools/xen-tools.conf files, it should appear to proceed (watch for warnings).
====Launching your VM====
If your VM was created successfully (watch for errors), you can now "boot" it.
The config file for your VM is located in /xen/conf/vm##.cfg, cat it and see how it is structured.
When ready to boot your VM, do the following:
vmserver:~# xm create -c /xen/conf/vm##.cfg
This will boot the VM and automatically attach you to the console of the VM. If you just want it to boot without viewing it, leave off the "-c".
When the machine is booted, you can detach from the virtual machine and return to the VMserver's prompt. To do this, hit: **CTRL-]** (control, close-square-bracket).
====Care and feeding of your VM====
Once the VM is running (assuming it was properly configured), it should have received an IP address, and should be reachable at the following address:
vm##.student.lab
Go ahead and try connecting to your VM via ssh (you can do this from lab46):
lab46:~$ ssh root@vm##.student.lab
On the VM server, you can use the **xm** tool to manage your running VMs. Run "xm help" to get a list of actions you can take.
In general, once you get your VMs up and running, you won't need to directly interact with the VM server.
Enjoy!