Categories
Tech

Clone Git Repo using SSH on a non-standard port

This command allows you to clone a git repo onto your local machine from a remote repository using ssh on a non-standard port (standard ssh port: 22). The example provided uses the non-standard port of 8888.

git clone ssh://username@remote_repo_host.com:8888/path/to/repo/from/root

Categories
Tech

Set hostname (FQDN & short name) in CentOS 6.x

To update system short name. Edit /etc/sysconfig/network and update the HOSTNAME field to the desired short-name.

HOSTNAME=node1

To update the systems fully qualified domain name. Edit /etc/hosts and insert a new entry following the notation of (host_ip // FQDN // short-name).
In our example:

  • host_ip = 192.168.0.2 (Yours will be different)
  • FQDN = node1.mydomain.local
  • short-name node1
192.168.0.2 node1.mydomain.local node1
Categories
Tech

Convert VMware Fusion (.vmwarevm or .vmdk) VM’s to Xen

This technique allows you to convert VMware based VM’s across to the Xen Hypervisor (current version 4.1.3)

This step might be unnessaray for VM’s that don’t utilise sparse based virtual harddrives, but its best just to do it so everyone is at the same step. Find the vmware-vdiskmanager utility included with your VMware install.

On Mac for VMware Fusion this can be found at:

/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager

Or in some other versions

/Library/Application\ Support/VMware\ Fusion/vmware-vdiskmanager

Change ‘cd’ into the relevant directory once found.
Consolidate the VMDK file

./vmware-vdiskmanager -r vm_to_be_converted.vmdk -t 0 temp.vmdk

Copy the temp VMDK across to the target Xen Hypervisor

scp temp.vmdk root@target_ip:/var/lib/libvirt/images

Once copied, use qumu-img to convert the VMDK file to a RAW format
qemu-img convert temp.vmdk -O raw /var/lib/libvirt/images/temp.img

Create a basic config file for the new VM

cd /etc/xen/new_vm_config

name = “new_vm”
memory = “256”
disk = [ ‘file:/var/lib/libvirt/images/temp.iso,hda,w’, ]
vif = [ ‘bridge=br0’, ]
bootloader=”/usr/bin/pygrub”
vcpus=1
on_reboot = ‘restart’
on_crash = ‘restart’

Boot up the new VM

xm create new_vm

You may find network may be unavailable, due to a change in MAC addresses assigned to the VM. Use virsh edit to find the current MAC address assigned to the VM, and update the network interface within the VM accordingly. Then reboot the VM or restart network services in order to re-establish network access.

Categories
Tech

Installing VMITools (VM Introspection Toolkit) with Xen on CentOS 6

This guide provides a good introduction on how to install VMI Tools and Xen on CentOS 6.

Due to dependancy requirements, CentOS 5 is unable to support VMITools by default unless a more recent version of glib2 is compiled from source. Therefore we base this installation on CentOS 6 (6.3 at time of writing).

Xen Installation

Redhat dropped support for Xen based virtualisation with the released of RHEL 6, resulting in the need to manually install the required Xen packages. In previous versions of this post I have referred to Falko’s excellent guide on installing Xen 4 on CentOS 6, link to guide can be found here.

However the recent release of the Xen kernel 3.6 has broken compatibility with the latest version of the libVirt (virsh). In order to restore compatibility we will install the slightly older version of Xen until the libVirt library is updated to resolve the error.

First we add the repos that still contain the older versions of Xen.

cd /etc/yum.repos.d/
wget http://www.gitco.de/linux/x86_64/centos/6/gitco-centos6-x86_64.repo
wget http://xenbits.xen.org/people/mayoung/EL6.xen/EL6.xen.repo

Edit gitco-centos6-x86_64.repo and add ‘enabled’ switches, so it looks like this. We only need this middle entry for Xen Files. The other repo we downloaded contains a better packaged Xen Kernel which we will use.

[gitco-kernel-dom0-centos6-x64]
name= GITCO [ KERNEL DOM0 ] Repository
baseurl=http://www.gitco.de/linux/x86_64/centos/6/kernel-dom0
enabled=0
gpgcheck=1
gpgkey=http://www.gitco.de/linux/x86_64/centos/6/GITCO-RPM-KEY

[gitco-xen4.0.1-centos6-x64]
name= GITCO [ XEN-4.0.1 ] Repository
baseurl=http://www.gitco.de/linux/x86_64/centos/6/xen4.0.1
enabled=1
gpgcheck=1
gpgkey=http://www.gitco.de/linux/x86_64/centos/6/GITCO-RPM-KEY

[gitco-misc-centos6-x64]
name= GITCO [ MISC PACKAGES ] Repository
baseurl=http://www.gitco.de/linux/x86_64/centos/6/misc
enabled=0
gpgcheck=1
gpgkey=http://www.gitco.de/linux/x86_64/centos/6/GITCO-RPM-KEY

yum install xen kernel-xen

follow the rest of falkos guide for the libvirt installation.

VMITools Installation

Install the required packages for installation.

yum install git glib2-devel check-devel

We create a folder named src in the root directory, to use as a basis for our installation.

mkdir /root/src/

cd into the src directory, and checkout a clone of the latest VMITools.

git clone https://code.google.com/p/vmitools/

cd into the vmitools folder, then run the following commands.

./autogen.sh
./configure

After a while the output should return success. Then perform make.

make

As well as installing the library (Optional, necessary for applications wishing to implement the libVMI framework.

make install

Now when you try to compile some of the examples you will run into this error.

Can be easily fixed by editing your .bashrc file within your home folder, and adding this line.

1.) use < .bashrc > file in your home directory (instead of .bash_profile)
2.) add the following line to this file:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib ; export LD_LIBRARY_PATH

DO ONE MORE THING : also add this line to < /etc/ld.so.conf > file