Below are the steps for creating a Xen virtual machine in Cirtic Xen server
1)List the available OS template list on the Xen server
----------------------------------------------------------
xe template-list
use the required the template uuid returned from the above command
Below is the command for creating virtual machine for Xen
--------------------------------------------------------------------------------
xe vm-install template="Ubuntu Trusty Tahr 14.04" new-name-label="vmname" sr-uuid=4bc0bfb7-14c9-72be-b8bb-d6e90f102376
sr-uuid is the uuid of the storage unit in the xen server
For getting the list of all storage on the xen server , use the command xe sr-list
2) Disable boot from VM hard disk
---------------------------------------------------------------
xe vbd-list vm-uuid=cc693c44-6dd5-aa1b-fd4e-5d69daf7d222 userdevice=0
xe vbd-param-set uuid=3a49a4bd-c43c-c9eb-3b83-8981571fcdfe bootable=false
3)To add the required ISO to the xen server
-------------------------------------------------------------------
copy the iso file to location /opt/xensource/packages/iso and then ran the below command.
Inorder to detect the newly added iso we had to scan the storage unit using the below command
xe sr-scan uuid=c31d41d1-9f76-7fbb-d6fc-d90eeab42292(sr uuid)
Now just use the command xe cd-list command to list the available ISO files in xen repository
4) Now add the ISO file to CDrom of the new VM and make it bootable
-----------------------------------------------------------------------
xe vm-cd-add vm="vmname" cd-name="ubuntu-14.04.3-server-amd64.iso" device=3
xe vbd-list vm-name-label="vmname" userdevice=3
xe vbd-param-set uuid=16240ae1-fde2-8d4e-fb40-92248b2c3f1c bootable=true
5) Get network interface list on host
-------------------------------------------------
xe network-list
create a new Virtual network for the new VM
xe network-create name-label="vmname_network"
Above command will give the uuid of the new network interface
and add the newly created network to the VM
xe vif-create vm-uuid=<vm-uuid> network-uuid=<network-uuid> device=1 mac=random
example : xe vif-create vm-uuid=cc693c44-6dd5-aa1b-fd4e-5d69daf7d222 network-uuid=6f5daa27-2621-a1b5-de12-88721958ff73 device=1 mac=random
Now plug this newly created interface to the VM
xe vif-plug uuid=b96978ec-9425-850a-f47e-61d204609aee
Change memory settings. By default, XenServer create debian VM with 256M RAM, check it out
----------------------------------------------------------------------------------------
xe vm-list name-label="newVM" params=all |grep memory
xe vm-memory-limits-set dynamic-max=1GiB dynamic-min=1GiB static-max=1GiB static-min=1GiB name-label="newVM"
Change disk size. By default, XenServer create debian VM with 8 GB disk, check it out
------------------------------------------------------------------------------------------
xe vm-disk-list vm="newVM"
Change disk size, for example to 20 GB, if need
xe vdi-resize uuid=[VDI uuid] disk-size=20GiB
start the VM
-------------------------------------------------
xe vm-start vm=newVM
Also for connecting the VNC to the virtual machine. Always make a ssh tunnel with virtual machine vnc port number
Now connect to the VM using vncviewer
----------------------------------------------------
vncviewer -via root@[xenserver] localhost:[port]
or you can create a ssh tunnel from vnc port of the xen server to the local server
ssh -L 5901:localhost:5902 root@IPadress
http://www.vogella.com/tutorials/Gerrit/article.html
1)List the available OS template list on the Xen server
----------------------------------------------------------
xe template-list
use the required the template uuid returned from the above command
Below is the command for creating virtual machine for Xen
--------------------------------------------------------------------------------
xe vm-install template="Ubuntu Trusty Tahr 14.04" new-name-label="vmname" sr-uuid=4bc0bfb7-14c9-72be-b8bb-d6e90f102376
sr-uuid is the uuid of the storage unit in the xen server
For getting the list of all storage on the xen server , use the command xe sr-list
2) Disable boot from VM hard disk
---------------------------------------------------------------
xe vbd-list vm-uuid=cc693c44-6dd5-aa1b-fd4e-5d69daf7d222 userdevice=0
xe vbd-param-set uuid=3a49a4bd-c43c-c9eb-3b83-8981571fcdfe bootable=false
3)To add the required ISO to the xen server
-------------------------------------------------------------------
copy the iso file to location /opt/xensource/packages/iso and then ran the below command.
Inorder to detect the newly added iso we had to scan the storage unit using the below command
xe sr-scan uuid=c31d41d1-9f76-7fbb-d6fc-d90eeab42292(sr uuid)
Now just use the command xe cd-list command to list the available ISO files in xen repository
4) Now add the ISO file to CDrom of the new VM and make it bootable
-----------------------------------------------------------------------
xe vm-cd-add vm="vmname" cd-name="ubuntu-14.04.3-server-amd64.iso" device=3
xe vbd-list vm-name-label="vmname" userdevice=3
xe vbd-param-set uuid=16240ae1-fde2-8d4e-fb40-92248b2c3f1c bootable=true
5) Get network interface list on host
-------------------------------------------------
xe network-list
create a new Virtual network for the new VM
xe network-create name-label="vmname_network"
Above command will give the uuid of the new network interface
and add the newly created network to the VM
xe vif-create vm-uuid=<vm-uuid> network-uuid=<network-uuid> device=1 mac=random
example : xe vif-create vm-uuid=cc693c44-6dd5-aa1b-fd4e-5d69daf7d222 network-uuid=6f5daa27-2621-a1b5-de12-88721958ff73 device=1 mac=random
Now plug this newly created interface to the VM
xe vif-plug uuid=b96978ec-9425-850a-f47e-61d204609aee
Change memory settings. By default, XenServer create debian VM with 256M RAM, check it out
----------------------------------------------------------------------------------------
xe vm-list name-label="newVM" params=all |grep memory
xe vm-memory-limits-set dynamic-max=1GiB dynamic-min=1GiB static-max=1GiB static-min=1GiB name-label="newVM"
Change disk size. By default, XenServer create debian VM with 8 GB disk, check it out
------------------------------------------------------------------------------------------
xe vm-disk-list vm="newVM"
Change disk size, for example to 20 GB, if need
xe vdi-resize uuid=[VDI uuid] disk-size=20GiB
start the VM
-------------------------------------------------
xe vm-start vm=newVM
Also for connecting the VNC to the virtual machine. Always make a ssh tunnel with virtual machine vnc port number
Now connect to the VM using vncviewer
----------------------------------------------------
vncviewer -via root@[xenserver] localhost:[port]
or you can create a ssh tunnel from vnc port of the xen server to the local server
ssh -L 5901:localhost:5902 root@IPadress
http://www.vogella.com/tutorials/Gerrit/article.html