Tuesday, May 6, 2008

Using Oracle VM templates on Linux with Xen

Oracle provides a good tools with Oracle VM and his console tool. But for people like me who uses Mandriva Linux for historical reasons its possible to use Oracle EL and Oracle 11g templates.
For Mandriva users its simple as download the two templates, in my case:
Then install Xen support for Mandriva:
  • xen-3.1.0-8mdv2008.0
  • xen-doc-3.1.0-8mdv2008.0
  • kernel-xen-3.1.0-8mdv2008.0
And his related packages.
Restart your computer making sure that Xen Kernel is used (for example 2.6.18-xen), usually Xen kernel is placed at the boton of the list and its not the default kernel to boot.
Then start and enable Xen services as root:
# /etc/init.d/xend start
# chkconfig xend on
Uncompress above images into any directory, for example:
# cd /home
# tar xvfz OVM_EL5U1_X86_PVM_4GB.tgz
# cd OVM_EL5U1_X86_PVM_4GB
# cat ../oracle11g_x86.tar.bz2.*|tar xvfj -
Above directory will look like:
[root@escorpion OVM_EL5U1_X86_PVM_4GB]# ls
oracle11g_x86.img README README.oracle system.img vm.cfg
[root@escorpion OVM_EL5U1_X86_PVM_4GB]#

system.img file is an LVM volume with Oracle EL 5 operating system, oracle11g_x86.img file is a complete /u01 directory with an Oracle 11g database ready to use.
Finally using your favourite text editor creates a file named /etc/xen/oracle with:
memory = 1024
name = "oracle"
disk = [ 'file:/home/OVM_EL5U1_X86_PVM_4GB/system.img,hda,w',
'file:/home/OVM_EL5U1_X86_PVM_4GB/oracle11g_x86.img,hdb,w' ]
bootloader="/usr/bin/pygrub"
root = "/dev/hda1 ro"
extra = "3"
hostname = "oracle"
vif=['mac=00:16:3E:23:85:8B']
To start your Oracle VM using Xen command line execute:
xm create oracle
To connect to the virtual machine console execute:
xm console oracle
If everything is fine, you can log into the virtual machine using root/ovsroot as username and password.
The Oracle VM will gets his IP address using DHCP so may be you need to check vif parameter at above file if Xen virtual machine can't get a valid IP number due to conflicts with another machine.
If not, once you enter to the VM using the console you can change the file
/etc/sysconfig/network-scripts/ifcfg-eth0
with something like this:
DEVICE=eth0
BOOTPROTO=static
IPADDR=10.1.1.34
NETMASK=255.255.255.0
ONBOOT=yes
METRIC=10
MII_NOT_SUPPORTED=yes
GATEWAY=10.1.1.1
USERCTL=no
DNS1=10.1.1.5
DNS2=10.254.0.5
RESOLV_MODS=yes
IPV6INIT=no
IPV6TO4INIT=no
Knows caveats:
  • Xen kernels Dom0 do not have all drivers compiled, in my case a driver for a wifi cards was not included.
  • If you want to reduce Xen VM memory usage, first log into Oracle instance and reduce the parameter memory_target to a value which fits into a new VM memory.
Finally these tips are valid for any Linux distributions which include Xen support, using Oracle template running with Xen we have several benefits:
  • You can gets an Oracle 11g database running in Linux distros not certified by Oracle.
  • You don't care about touching your OS parameters, database users and groups, simple you can get an Oracle instance for development purpose ready to use unpacking a few files.
  • Oracle 11g running with Xen and Oracle EL paravirtualized version is faster than Oracle 11g running on VMWare or VirtualBox, Xen only impose a 0.4% of overhead into guest operating system.
  • If you have any problem with your database, simply restore your .img files and start again your Xen virtual machine, this is also valid if you want to perform a backup.
  • The memory footprint of the Xen virtual machine is similar as a native instance of the database, for example if you configure your Oracle instance to use 800Mb of RAM, your VM will use a little of megabytes extras.
Well this is my list of benefits may be other user will have your own list.

5 comments:

Sam said...

Hi Marcelo,

Very good tip. I liked it and solved my problem - how to login to the VM template server without using chicken VNC. (Also vi issues with that chicken vnc).

Do you know how to invoke GUI interface to the VM template server ? (not the web admin interface)?

Also How do we create windows 7 or XP environment using oracle VM ?

Do we need to create CD-ISO image of Windows s/w and copy to seed_pool to install the s/w ?

Marcelo Ochoa said...

Hi Sam:
I nevever tried a Windows installation with Xen support.
AFAIK its necessary a CD image for the installation and the VNC. Finally you can install the optimized NIC and video drivers provided by Oracle, you can find more information at:
http://itnewscast.com/underground-oracle-vm-manual
http://download.oracle.com/docs/cd/E15458_01/index.htm
For creating another OEL VMs from scratch the easy way is to use Oracle JeOS:
http://www.oracle.com/technology/software/products/virtualization/vm_jeos.html
I am using JeOS inside the Oracle VM to creates new Oracle VMs :)
HTH, Marcelo.

Sam said...

Thanks Marcelo.

Agustin said...

Hi Marcelo,
Thank you for putting together this site, it is full of good tips and useful info.
I am new to Oracle VM and am trying the following.
Objective: Install a HRCM Peoplesoft Environment in one stand along PC.
So far I have achieved the following:
1. Downloaded and installed Oracle VM Server = done.
2. Downloaded and installed Oracle VM Manager = Done.
At the moment I am stuck at this point. I am not able to access Oracle VM Manager Web page. I understand that to access the Oracle VM Manager home page I need to go to: http://127.0.0.1:8888/OVS and use the default user 'admin' with password 'oracle'. My problem is that I don’t have a browser installed in my box at the moment.
My questions are:
I only have access at the moment to the command line (root). How do I launch Oracle VM Manager main web page? How can I install a browser from the command line?
Thank you for reading my post, your help is appreciated in advance.
Regards
Agustin

Marcelo Ochoa said...

Hi Agustin:
Oracle VM manager is designed to be use from your desktop.
I mean, you can connect instead of using http://127.0.0.1/OVS using the public IP of your VM Manager instance, this IP was asked during the first boot, so it can be somethink like http://x.x.x.x/OVS.
If you have firewall problems that prevent you to connect directly to the public IP of the VM Manager using the port 8888 you can connect using an SSH tunnel in your Oracle VM, for example:
ssh -e none -f -N -C -2 -L 8888:public-ip-of-vm-manager:8888 root@public-ip-of-vm-server
replace the value of your both public IPs and finally connect to localhost:8888 on your desktop computer where you run the ssh command.
Best regards, Marcelo.