Citrix XenServer – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Thu, 22 Nov 2018 12:20:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How To Create Ubuntu 16.04 LTS VM in XenServer 6.2 https://tecadmin.net/install-ubuntu-16-04-in-xenserver/ https://tecadmin.net/install-ubuntu-16-04-in-xenserver/#comments Tue, 09 Aug 2016 02:14:47 +0000 https://tecadmin.net/?p=10450 Few days back, after creating a xenserver i found that there no template available for creating Ubuntu 16.04 LTS vm, even their was no template for Ubuntu 14.04 LTS. So first I had added template of required Ubuntu version in xenserver. Use this article to add new template for Ubuntu 16.04 LTS operating system. This [...]

The post How To Create Ubuntu 16.04 LTS VM in XenServer 6.2 appeared first on TecAdmin.

]]>
Few days back, after creating a xenserver i found that there no template available for creating Ubuntu 16.04 LTS vm, even their was no template for Ubuntu 14.04 LTS. So first I had added template of required Ubuntu version in xenserver. Use this article to add new template for Ubuntu 16.04 LTS operating system. This tutorial will help you to create Ubuntu 16.04 LTS vm using netboot url on citrix xenserver.

Create Ubuntu 16.04 LTS VM

After adding template in your Ubuntu system let’s started with creating new vm. Open xencenter and right-click on xenserver host and click New VM…

install-ubuntu-1604-in-xs-1

Now input name for the newly creating vm and a meaningful description. Description can be like purpose of creating vm. specs of vm etc.

install-ubuntu-1604-in-xs-2

Select installation media source. If you have already have ISO, select first option and choose ISO from library. Else you can use second option to install using net install url. Enter http://us.archive.ubuntu.com/ubuntu as netinstall url.

install-ubuntu-1604-in-xs-3

Here you need to select the xenserver on which you need to create vm. By default it will select the xenserver which you selected during virtual machine creating start. For this tutorial we have only one xenserver here.

install-ubuntu-1604-in-xs-4

Now select the number of virtual cpus for your new vm and memory to be allocate to this new vm.

install-ubuntu-1604-in-xs-5

Now select the size of storage. By default it uses 8GB (According to configure in template), but you can change it by clicking Properties button.

install-ubuntu-1604-in-xs-6

Select the network interfaces to be attached to your vm. use Add or Delete button to manage network interface. Using properties button you can manage mac addressing on interfaces.

install-ubuntu-1604-in-xs-7

Now check the details for new vm creating. Select the option “Start the new VM automatically” to boot vm immediate after creation.

install-ubuntu-1604-in-xs-8

Wait until new vm created and booted successfully. You can find the log messages in logs tab.

install-ubuntu-1604-in-xs-9

If everything goes successfully you will get screen something like below. Where your operating system installation screen appears.

install-ubuntu-1604-in-xs-10

Now follow the on screen instructions to complete the installation.

The post How To Create Ubuntu 16.04 LTS VM in XenServer 6.2 appeared first on TecAdmin.

]]>
https://tecadmin.net/install-ubuntu-16-04-in-xenserver/feed/ 7
How To Add Ubuntu 16.04 LTS Template in XenServer 6.2 https://tecadmin.net/add-ubuntu-16-04-lts-template-on-xenserver/ https://tecadmin.net/add-ubuntu-16-04-lts-template-on-xenserver/#comments Fri, 05 Aug 2016 18:36:46 +0000 https://tecadmin.net/?p=10196 Today I have installed a new Citrix XenServer 6.2 at my workplace. When I connect it through XenCenter 6.2, I could not find a template for Ubuntu 16.04 LTS or 14.04 LTS. After googling I found below steps to create template for Ubuntu 16.04 LTS or 14.04 LTS in XenServer. How To Add Ubuntu 16.04 [...]

The post How To Add Ubuntu 16.04 LTS Template in XenServer 6.2 appeared first on TecAdmin.

]]>
Today I have installed a new Citrix XenServer 6.2 at my workplace. When I connect it through XenCenter 6.2, I could not find a template for Ubuntu 16.04 LTS or 14.04 LTS. After googling I found below steps to create template for Ubuntu 16.04 LTS or 14.04 LTS in XenServer. How To Add Ubuntu 16.04 LTS Template in XenServer 6.2.

Step 1 – Update pygrub in Xenserver

  • Edit the file /usr/lib/python2.4/site-packages/grub/GrubConf.py on the XenServer host machine.
  • Got to line no 428 and change
    from:

    if arg.strip() == "${saved_entry}":
    

    to:

    if arg.strip() == "${saved_entry}" or arg.strip() == "${next_entry}":
    
  • Let’s start with creating new vms.

Step 2 – Create Templates for Ubuntu

Now execute following commands one by one to add a new template to the XenServer host. Below is the commands for adding Ubuntu 16.04 LTS and Ubuntu 14.04 LTS templates in your system. Add template as per your requirements.

Add Ubuntu 16.04 LTS Template

$ UUID=`xe template-list name-label="Ubuntu Precise Pangolin 12.04 (64-bit)" params=uuid --minimal`
$ NEW_UUID=`xe vm-clone uuid=$UUID new-name-label="Ubuntu Xenial 16.04 (64-bit)"`
$ xe template-param-set other-config:default_template=true other-config:debian-release=xenial uuid=$NEW_UUID

Add Ubuntu 14.04 LTS Template

$ UUID=`xe template-list name-label="Ubuntu Precise Pangolin 12.04 (64-bit)" params=uuid --minimal`
$ NEW_UUID=`xe vm-clone uuid=$UUID new-name-label="Ubuntu Trusty 14.04 (64-bit)"`
$ xe template-param-set other-config:default_template=true other-config:debian-release=trusty uuid=$NEW_UUID

Step 3 – Create New VM using Template

At this step, start with creating new VM using the newly created template. Open XenCenter, Right click on XenServer host and click New VM.

Add Ubuntu 16.04 LTS Template in XenServer 1

Enter the name and description of your new VM.

Add Ubuntu 16.04 LTS Template in XenServer 2

Select installation media source. If you have already had ISO, select the first option and choose ISO from the library. Else you can use the second option to install using net install URL. Enter http://us.archive.ubuntu.com/ubuntu as net install URL.

Add Ubuntu 16.04 LTS Template in XenServer 3

Now, follow the remaining on screen steps and complete Ubuntu 16.04 virtual machine installation on Citrix XenServer.

The post How To Add Ubuntu 16.04 LTS Template in XenServer 6.2 appeared first on TecAdmin.

]]>
https://tecadmin.net/add-ubuntu-16-04-lts-template-on-xenserver/feed/ 10
How to Backup Running Virtual Machine in XenServer https://tecadmin.net/backup-running-virtual-machine-in-xenserver/ https://tecadmin.net/backup-running-virtual-machine-in-xenserver/#comments Mon, 01 Aug 2016 04:28:21 +0000 https://tecadmin.net/?p=5463 Backup running Virtual Machine in XenServer. I am working with Citrix XenServer for many years and managing all XenServers using XenCenter installed on a standalone windows machine. We regularly take backup of VMs manually until today, I always take backups after shutting down the VM. Most of VM owner getting disappointed due to server down [...]

The post How to Backup Running Virtual Machine in XenServer appeared first on TecAdmin.

]]>
Backup running Virtual Machine in XenServer. I am working with Citrix XenServer for many years and managing all XenServers using XenCenter installed on a standalone windows machine. We regularly take backup of VMs manually until today, I always take backups after shutting down the VM. Most of VM owner getting disappointed due to server down for a long time. While searching for the Google I found a better way to back up VMs without shutdown them. It means we can take running VM backups and not downtime occurred.

citrix-image

This tutorial we will help you step by step backup process of running VM. Also here is a shell script which can take all VMs backup or specified VM backup, which we can schedule through crontab as well.

Method 1 – Manual Backup of Running VM

Following steps also can be performed through XenCenter, But Linux lovers love the command line. So find commands to do it.

1.1. Find VMs UUID

Use the following command to get list of UUIDs of all vms along with other details. this UUID will be used in next step

xe vm-list is-control-domain=false is-a-snapshot=false

Sample Output:

uuid ( RO)           : 8ac95696-94f3-83c1-bc89-8bb2603f832b
     name-label ( RW): test-vm
    power-state ( RO): running

As per above output test-vm uuid is “8ac95696-94f3-83c1-bc89-8bb2603f832b“. It can be different in your case.

1.2. Create VMs Snapshot

Now use the following command to create snapshot of vm using uuid found in above step. Make sure you are using correct uuid.

xe vm-snapshot uuid=8ac95696-94f3-83c1-bc89-8bb2603f832b new-name-label=testvmsnapshot

Above command will retrun a UUID of snapshot, Use that UUID to convert snapshot to a vm, so we can export it to file using below command.

xe template-param-set is-a-template=false ha-always-run=false uuid=b15c0531-88a5-98a4-e484-01bc89131561

1.3. Export Snapshot to File

Now we can export created snapshot to .xva file, Which can be easily restored from command line or XenCenter.

xe vm-export vm=b15c0531-88a5-98a4-e484-01bc89131561 filename=vm-backup.xva

1.4. Destroy Snapshot

Finally as we have already taken backup to xva file, so we can destroy created snapshot from xenserver.

xe vm-uninstall uuid=b15c0531-88a5-98a4-e484-01bc89131561 force=true

Method 2 – Using Script for Backup Running VMs

To backup all VMs running on XenServer, we can use following shell script also. This script mounted remote file system exported through NFS. This script works for me perfectly, but it may not for you. So use this script at your own risk.

#!/bin/bash
#
# Written By: Mr Rahul Kumar
# Created date: Jun 14, 2014
# Last Updated: Mar 08, 2017
# Version: 1.2.1
# Visit: https://tecadmin.net/backup-running-virtual-machine-in-xenserver/
#

DATE=`date +%d%b%Y`
XSNAME=`echo $HOSTNAME`
UUIDFILE=/tmp/xen-uuids.txt
NFS_SERVER_IP="192.168.10.100"
MOUNTPOINT=/xenmnt
FILE_LOCATION_ON_NFS="/backup/citrix/vms"

### Create mount point

mkdir -p ${MOUNTPOINT}

### Mounting remote nfs share backup drive

[ ! -d ${MOUNTPOINT} ]  && echo "No mount point found, kindly check"; exit 0
mount -F nfs ${NFS_SERVER_IP}:${FILE_LOCATION_ON_NFS} ${MOUNTPOINT}

BACKUPPATH=${MOUNTPOINT}/${XSNAME}/${DATE}
mkdir -p ${BACKUPPATH}
[ ! -d ${BACKUPPATH} ]  && echo "No backup directory found"; exit 0


# Fetching list UUIDs of all VMs running on XenServer
xe vm-list is-control-domain=false is-a-snapshot=false | grep uuid | cut -d":" -f2 > ${UUIDFILE}

[ ! -f ${UUIDFILE} ] && echo "No UUID list file found"; exit 0

while read VMUUID
do
    VMNAME=`xe vm-list uuid=$VMUUID | grep name-label | cut -d":" -f2 | sed 's/^ *//g'`

    SNAPUUID=`xe vm-snapshot uuid=$VMUUID new-name-label="SNAPSHOT-$VMUUID-$DATE"`

    xe template-param-set is-a-template=false ha-always-run=false uuid=${SNAPUUID}

    xe vm-export vm=${SNAPUUID} filename="$BACKUPPATH/$VMNAME-$DATE.xva"

    xe vm-uninstall uuid=${SNAPUUID} force=true

done < ${UUIDFILE}

umount ${MOUNTPOINT}

Download this script directly from Github.com

The post How to Backup Running Virtual Machine in XenServer appeared first on TecAdmin.

]]>
https://tecadmin.net/backup-running-virtual-machine-in-xenserver/feed/ 24
How To Add CentOS 7 Template in XenServer 6.2 https://tecadmin.net/add-centos-7-template-in-xenserver/ https://tecadmin.net/add-centos-7-template-in-xenserver/#respond Wed, 11 May 2016 19:34:42 +0000 https://tecadmin.net/?p=10469 Recently I had installed a new citrix xenserver 6.2 at my workplace. When I connect it through xencenter, I could not find template for CentOS 7 operating system. After googling I found below steps to add template for CentOS 7 in xenserver. How To Add CentOS 7 Template in XenServer 6.2 . Step 1 – [...]

The post How To Add CentOS 7 Template in XenServer 6.2 appeared first on TecAdmin.

]]>
Recently I had installed a new citrix xenserver 6.2 at my workplace. When I connect it through xencenter, I could not find template for CentOS 7 operating system. After googling I found below steps to add template for CentOS 7 in xenserver. How To Add CentOS 7 Template in XenServer 6.2 .

Step 1 – Update pygrub in XenServer

  • Edit /usr/lib/python2.4/site-packages/grub/GrubConf.py on the XenServer host machine.
  • Got to line no 428 and change
    from:

        if arg.strip() == "${saved_entry}":
    

    to:

        if arg.strip() == "${saved_entry}" or arg.strip() == "${next_entry}":
    
  • Let’s start with creating new vms.

Step 2 – Create CentOS 7 Template

Now execute following commands one by one to add new template in xenserver host. Below is the commands for adding CentOS 7 template in your xenserver host system.

$ UUID=`xe template-list name-label="CentOS 6 (64-bit)" params=uuid --minimal`
$ NEW_UUID=`xe vm-clone uuid=$UUID new-name-label="CentOS 7 (64-bit)"`
$ xe template-param-set uuid=$NEW_UUID other-config:default_template=true 

Step 3 – Create New VM using Template

Let’s start with creating new vm using newly created template. Open xencenter and right-click on xenserver host and click New VM…

xenserver-centos7-1

In the next steps you can select installation media source. If you have already have ISO, select first option and choose ISO from library. Else you can use second option to install using net install url. Enter http://mirror.centos.org/centos/7/os/x86_64 as net install url.

The post How To Add CentOS 7 Template in XenServer 6.2 appeared first on TecAdmin.

]]>
https://tecadmin.net/add-centos-7-template-in-xenserver/feed/ 0
How to Limit Bandwidth on Network Interfaces of XenServer VM https://tecadmin.net/limit-bandwidth-on-network-interfaces-of-xenserver-vm/ https://tecadmin.net/limit-bandwidth-on-network-interfaces-of-xenserver-vm/#respond Wed, 25 Jun 2014 10:22:33 +0000 https://tecadmin.net/?p=5664 In the virtual hosting environment, if you’re providing VPS services to your clients. Then you may also need to setup bandwidth limit for all interfaces in virtual machines. So that no one vms can use more bandwidth than limit set. In other situation to limit bandwidth is also helpful for preventing multiple attacks which consumes [...]

The post How to Limit Bandwidth on Network Interfaces of XenServer VM appeared first on TecAdmin.

]]>
In the virtual hosting environment, if you’re providing VPS services to your clients. Then you may also need to setup bandwidth limit for all interfaces in virtual machines. So that no one vms can use more bandwidth than limit set.

citrix-image

In other situation to limit bandwidth is also helpful for preventing multiple attacks which consumes lots of bandwidth. In this tutorial we will help you How to Limit Bandwidth Rate on Network Interfaces of Citrix XenServer VM.

Method 1. Limit Bandwidth using XenCenter

This is known as QOS limit. To enable this open your XenCenter and connect to your XenServer. Now Select the the VM and go to Networking tab to which you need to setup QOS limit.

Xen-Limit-1

Now select the interface and open properties of that interface. You will get a properties window like below where you can set QOS limit and click OK

Xen-Limit-2

Method 2. Limit Bandwidth using XenServer Command Line

Steps coming soon…

The post How to Limit Bandwidth on Network Interfaces of XenServer VM appeared first on TecAdmin.

]]>
https://tecadmin.net/limit-bandwidth-on-network-interfaces-of-xenserver-vm/feed/ 0
How to Backup VMs Metadata in Citrix Xenserver https://tecadmin.net/backup-vms-metadata-in-citrix-xenserver/ https://tecadmin.net/backup-vms-metadata-in-citrix-xenserver/#respond Wed, 04 Jun 2014 14:02:34 +0000 https://tecadmin.net/?p=5445 This article describes how to back up metadata for an individual Virtual Machines on Citrix Xen Servers. In this article, you will get step by step instructions for backing up metadata. Also at end of this article, there is a small shell script which can be used for backup metadata for all VMs running on [...]

The post How to Backup VMs Metadata in Citrix Xenserver appeared first on TecAdmin.

]]>
This article describes how to back up metadata for an individual Virtual Machines on Citrix Xen Servers. In this article, you will get step by step instructions for backing up metadata. Also at end of this article, there is a small shell script which can be used for backup metadata for all VMs running on the Xen server.

citrix-image

1. Backup VMs Metadata in Citrix Xenserver

1.1. Find VMs UUID

Use the following command to get list of UUIDs of all vms along with other details. this UUID will be used in next steps.

xe vm-list is-control-domain=false is-a-snapshot=false
uuid ( RO)           : 8ac95696-94f3-83c1-bc89-8bb2603f832b
     name-label ( RW): test-vm
    power-state ( RO): running

As per above output test-vm uuid is “8ac95696-94f3-83c1-bc89-8bb2603f832b“.

1.2. Backup Metadata using UUID

After getting UUID of vm, use following command to backup metadata of virtual machine with uuid 8ac95696-94f3-83c1-bc89-8bb2603f832b and create metadata backup file metadata.bak.

xe vm-export filename=metadata.bak uuid=8ac95696-94f3-83c1-bc89-8bb2603f832b metadata=true

You have completed vm metadata backup successfully.

2. Script for Backup All VMs Metadata

This is a good option to schedule metadata backup regularly. You can schedule the below script for backup all the vms metadata on Xen server.

How to use script:

2.1 – Copy this script to a file /scripts/metadata-backup.sh in xenserver.

2.2 – This script is using a remote backup server mounted using nfs, You can replace this with your own settings.

2.3 – Execute this script using sh /scripts/metadata-backup.sh.

2.4 – For regular backup schedule this in systems crontab. [Crontab Examples]

#!/bin/bash

DATE=$(date +%d%B%y)
XSNAME=`echo $HOSTNAME`
mkdir -p /mnt/nfs

mount -F nfs 192.168.10.100:/backup/citrix/metadata /mnt/nfs

BACKUPPATH=/mnt/nfs/$XSNAME/$DATE
mkdir -p $BACKUPPATH

xe vm-list is-control-domain=false is-a-snapshot=false | grep uuid | cut -d":" -f2 >  /tmp/uuids.txt

while read line
do
    VMNAME=`xe vm-list uuid=$line | grep name-label | cut -d":" -f2 | sed 's/^ *//g'`
    xe vm-export filename="$BACKUPPATH/$XSNAME-$VMNAME-$DATE" uuid=$line metadata=true
done < /tmp/uuids.txt
umount /mnt/nfs

The post How to Backup VMs Metadata in Citrix Xenserver appeared first on TecAdmin.

]]>
https://tecadmin.net/backup-vms-metadata-in-citrix-xenserver/feed/ 0