Oracle VM JeOS README

Target

This document is by no means an exhaustive description of how to create and productize an Oracle VM Template. The Oracle VM JeOS (Just enough OS) is just one piece required to create an Oracle VM Template. It will however aim to give the reader a good understanding of the JeOS scripts and images currently part of the toolkit.

What is included

The current toolkit consists of a pre-created generic Enterprise Linux (4.7 & 5.2) JeOS image and a script to modify the image. The script allows for adding more RPMs to the image as well as re-sizing the image.

Getting started

The script takes a few parameters when executed to accomplish creating the JeOS specifically for the template. For this README we will go through the steps of creating an Oracle VM JeOS that will be capable of running the Oracle Database 11g.

Environment

Using the script the one can create a JeOS for a specific template without requiring access to a real Oracle VM; it does however require that you have root access on the system you intend to create the JeOS on. To be able to test the JeOS (and most likely to install the application for the template that will use the JeOS) one would require access to an Oracle VM Server as well as permission to create/destroy the Oracle VM domain.

Steps to create the template

Kit contents

The kit consists of the RPM that contains the modifyjeos command and a set of RPMs each containing a specific OS release for a specific architecture. The RPMs are listed below:

ovm-modify-jeos-1.0.1-11.el5.noarch.rpm

Always need to install this RPM. It is used to instantiate any of the available JeOS images listed below.

ovm-el5u2-xvm-jeos-1.0.1-6.el5.i386.rpm

Install this RPM to be able to create an Enterprise Linux 5 Update 2 JeOS for the i386 architecture – Optional.

ovm-el5u2-xvm-jeos-1.0.1-6.el5.x86_64.rpm

Install this RPM to be able to create an Enterprise Linux 5 Update 2 JeOS for the x86_64 architecture – Optional.

ovm-el4u7-xvm-jeos-1.0.1-6.el4.i386.rpm

Install this RPM to be able to create an Enterprise Linux 4 Update 7 JeOS for the i386 architecture – Optional.

ovm-el4u7-xvm-jeos-1.0.1-6.el4.x86_64.rpm

Install this RPM to be able to create instantiate an Enterprise Linux 4 Update 7 JeOS for the x86_64 architecture – Optional.

ovm-template-config-1.0.1-6.el5.noarch.rpm

This RPM is already installed in all the JeOS images listed above, it is really supplied for reference and for people that want to create their own JeOS from scratch. Please see Appendix A for more information on template reconfiguration.

OS DVD or Yum Repository (if you are planning to add RPMs to the image)

If you are planning to add any RPMs to the image, the location of the mounted OS DVD or Yum repository would need to be specified. This is required to resolve any dependencies that might arise.

modifyjeos

The modifyjeos script takes a few options to customize the JeOS image for your specific template deployment.

Options:

-i specify the tag of the required JeOS e.g.: -i EL52_x86_64_HVM_jeos (Required) (Use modifyjeos -h to see a list of available tags)

-f specify the name of the image file e.g.: -f System.img (Required if -i is not supplied)

-dir specify the directory where the images should be create d in (-i) or can be found (-f) (Optional)

-n name of the template, e.g.: -n MyTemplate (Optional. Defaults to the tag name if not specified)

-a name of the file containing the list of RPMs that will be added to the image e.g.: -a addrpm.lst (file format is one RPM name per line) (Optional) (Note that the -m option is required when specifying this option)

-m directory where the RPMs listed in the file passed by the -a option can be found, e.g.: -m /tmp/rpms (Required when -a is specified)

-p name of the file containing the list of packages that will be added to the image e.g.: -p addpkg.lst (file format is one package name per line) (Optional) (Note the difference between this and the -a option is that the packages will be installed directly from the YUM repository and as such the -m is ignored)

-e name of the file containing the list of RPMs that will be erased from the image e.g.: -e delrpm.lst (file format is the full RPM name per line) (Optional) (Note that the RPM will not be erased if it there are other RPMs that still depends on it)

-I initial root partition size, in other words how much FREE space is desired BEFORE any action are to be taken (i.e. add/erase RPMs) have been started specified in MB, e.g.: -I 512 (Optional)

-R root partition post PAD size, in other words how much FREE space is desired AFTER all other actions (i.e. add/erase RPMs) have been completed specified in MB, e.g.: -R 512 (Optional)

-S size of the swap partition in MB, e.g.: -S 2048 (Optional)

-r is used to specify a YUM repository URI instead of the DVD mount point (-l option), e.g.: -r http://yumrepo.example.com/ (Required if -l is not specified)

-l mount point of the OS DVD, us this if a YUM repository with the OS RPMs is not available, e.g.: -l /media/EnterpriseLinux (Required if -r is not specified)

-on turns the comma separated run level services on (Note that the default run levels for the service will be turned on), e.g.: -on oraclevm-template,iptables (Optional)

-off turns the comma separated run level services off (Note that the service will be turned off for all run levels), e.g.: -off oraclevm-template,iptables (Optional)

-mem set the amount of memory the VM will use in MB, e.g.: -mem 1024 (Optional: default to 1024 or 1 GB)

-cpu specify the number of vcpu's for the VM, e.g.: -cpu 4 (Optional: Default to 2)

-P creates a disk image of the specified name and size in MB and optionally a mount point for the image. If a mount point is specified, a file system will be created and mounted. The mount will be persisted in the /etc/fstab of the VM. The mounts are done in order of specification so it is possible to have a later image mount under an earlier one, e.g.: -P Database.img 8192 or -P Database.img 8192 /oracle (Optional)

-remove is used to remove previously configured disk images with -P (only valid with the -f option)

-conf set the name of the template configuration script (the default is /u01/oraclevm-template.sh), e.g.: -conf /opt/scripts/template-config.sh (Optional)

-cln set the name of the template cleanup script (the default is /u01/template-cleanup.sh), e.g.: -cln /opt/scripts/template-cleanup.sh (Optional)

-log set the name of the output log file (the default is /var/log/modifyjeos.log), e.g.: -log TestVM.log (Optional)

-nogpg disables the checking of the GPG signature on the RPMS being installed, e.g.: -nogpg (Optional)

For example for the Oracle Database 11g using the -a option:

# cat addrpm.lst

oracle-validated-1.0.0-8.el5.i386.rpm


# ls -l rpms/

-r--r--r-- 1 root root 11769 May 26 07:20 oracle-validated-1.0.0-8.el5.i386.rpm


# modifyjeos \

-i EL52_i386_PVM_jeos \

-n MyOracleDBTemplate \

-a addrpm.lst -m rpms \

-mem 4096 -cpu 8 \

-r http://yumrepo.example.com/yum/EL5/U2/i386 \

-S 3072 -I 2048 -R 9728 \

-P OptDisk.img 3072 /opt \

-P Oracle11g.img 5120 /opt/oracle \

-P ASMDisk.img 10240



Same example for the Oracle Database 11g using the -p option:

# cat addpkg.lst

oracle-validated


# modifyjeos

-i EL52_i386_PVM_jeos \

-n MyOracleDBTemplate \

-p addpkg.lst \

-mem 4096 -cpu 8 \

-r http://yumrepo.example.com/yum/EL5/U2/i386 \

-S 3072 -I 2048 -R 9728

-P OptDisk.img 3072 /opt \

-P Oracle11g.img 5120 /opt/oracle \

-P ASMDisk.img 10240


The resulting OS image file is now ready for the installation of the Oracle Database 11g as all the required OS components required by the Oracle Database 11g will be installed.

Deploy the Image

As part of the base JeOS image a set of scripts are supplied to reconfigure the image at first start (The modifyjeos script will reset the image so that the reconfigure scripts will run at next boot if the -a or -e option were supplied, this can overwritten using the -off option).

Appendix A

Template reconfiguration

The basic JeOS contains the oraclevm-template-config RPM which is used to reconfigure the template when booted up the first time. The process involves an init.d script that will run at first boot of the template. The script will check to see if the /etc/sysconfig/oraclevm-template file exist and read the flags from the file. Currently only two flags are recognized: RUN_TEMPLATE_CONF and TEMPLATE_CONFIG_SCRIPT.

The RUN_TEMPLATE_CONF flag is used to control the starting of the reconfiguration process. Valid values for the parameter is YES and NO. If the flag is not set to YES, the reconfiguration process will be skipped at boot time.

The TEMPLATE_CONFIG_SCRIPT flag is used to override the default reconfiguration script location and name. The default location for the product reconfiguration script is the root partition of the second disk image file's first partition. The default name of the script is oracle-template.sh. If a second disk image is detected and its first partition is not mounted, the init.d script will try to mount it before attempting to execute the reconfiguration script without regard to the flag setting.

The TEMPLATE_CLEANUP_SCRIPT flag is used to override the default cleanup script location and name. The default location for the cleanup script is the root partition of the second disk image file's first partition. The default name of the script is template-cleanup.sh.

The responsibility of the reconfiguration scripts is to configure and cleanup all the products in the template. Two separate scripts should be provided, one for configuration and a different one for cleanup. The cleanup script is used to ready the template for shipping and / or reconfiguration. Essentially, the cleanup script should reverse the normal configuration done as well as clean up all the logs, history files etc.