Exalogic 2.0.1 Tea Break Snippets - Modifying the Default Shipped Template

Having installed your Exalogic Virtual environment by default you have a single template which can be used to create your vServers. Although this template is suitable for creating simple test or development vServers it is recommended that you look at creating your own custom vServers that match the environment you wish to build and deploy. Therefore this Tea Time Snippet will take you through the simple process of modifying the standard template.

Before You Start

To edit the template you will need the Oracle ModifyJeos Utility which can be downloaded from the eDelivery Site.

eDelivery
eDelivery
eDelivery

Once the ModifyJeos Utility has been downloaded we can install the rpms onto either an existing vServer or one of the Control vServers.

rpm -ivh ovm-modify-jeos-1.0.1-10.el5.noarch.rpm
rpm -ivh ovm-template-config-1.0.1-5.el5.noarch.rpm

Alternatively you can install the modify jeos packages on a none Exalogic OEL installation or a VirtualBox image. If you are doing this, assuming OEL 5u8, you will need the following rpms.

rpm -ivh ovm-modify-jeos-1.0.1-10.el5.noarch.rpm
rpm -ivh ovm-template-config-1.0.1-5.el5.noarch.rpm

Base Template

If you have installed the modify onto a vServer running on the Exalogic then simply mount the /export/common/images from the ZFS storage and you will be able to find the el_x2-2_base_linux_guest_vm_template_2.0.1.1.0_64.tgz (or similar depending which version you have) template file. Alternatively the latest can be downloaded from the eDelivery Site.

eDelivery
eDelivery
eDelivery

Now we have the Template tgz we will need the extract it as follows:

tar -zxvf  el_x2-2_base_linux_guest_vm_template_2.0.1.1.0_64.tgz

This will create a directory called BASE which will contain the System.img (VServer image) and vm.cfg (VServer Config information). This directory should be renamed to something more meaning full that indicates what we have done to the template and then the Simple name / name in the vm.cfg editted for the same reason.

Modifying the Template

Resizing Root File System

By default the shipped template has a root size of 4 GB which will leave a vServer created from it running at 90% full on the root disk. We can simply resize the template by executing the following:

modifyjeos -f System.img -T <New Size MB>)

For example to imcrease the default 4 GB to 40 GB we would execute:

modifyjeos -f System.img -T 40960)

Resizing Swap

We can modify the size of the swap space within a template by executing the following:

modifyjeos -f System.img -S <New Size MB>)

For example to increase the swap from the default 512 MB to 4 GB we would execute:

modifyjeos -f System.img -S 4096)

Changing RPMs

Adding RPMs

To add RPMs using modifyjeos, complete the following steps:

  1. Add the names of the new RPMs in a list file, such as addrpms.lst. In this file, you should list each new RPM in a separate line.
  2. Ensure that all of the new RPMs are in a single directory, such as rpms.
  3. Run the following command to add the new RPMs:
modifyjeos -f System.img -a <path_to_addrpms.lst> -m <path_to_rpms> -nogpg

Where <path_to_addrpms.lst> is the path to the location of the addrpms.lst file, and <path_to_rpms> is the path to the directory that contains the RPMs. The -nogpg option eliminates signature check on the RPMs.

Removing RPMs

To remove RPM s using modifyjeos, complete the following steps:

  1. Add the names of the RPMs (the ones you want to remove) in a list file, such as removerpms.lst. In this file, you should list each RPM in a separate line. The Oracle Exalogic Elastic Cloud Administrator's Guide provides a list of all RPMs that must not be removed from the vServer.
  2. Run the following command to remove the RPMs:
modifyjeos -f System.img -e <path_to_removerpms.lst>

Where <path_to_removerpms.lst> is the path to the location of the removerpms.lst file.

Mounting the System.img

For all other modifications that are not supported by the modifyjeos command (adding you custom yum repositories, pre configuring NTP, modify default NFSv4 Nobody functionality, etc) we can mount the System.img and access it directly. To facititate quick and easy mounting/unmounting of the System.img I have put together the simple scripts below.

MountSystemImg.sh

#!/bin/sh

# The script assumes it's being run from the directory containing the System.img

# Export for later i.e. during unmount
export LOOP=`losetup -f`
export SYSTEMIMG=/mnt/elsystem
# Make Temp Mount Directory
mkdir -p $SYSTEMIMG
# Create Loop for the System Image
losetup $LOOP System.img
kpartx -a $LOOP
mount /dev/mapper/`basename $LOOP`p2 $SYSTEMIMG
#Change Dir into mounted Image
cd $SYSTEMIMG

UnmountSystemImg.sh

#!/bin/sh

# The script assumes it's being run from the directory containing the System.img

# Assume the $LOOP & $SYSTEMIMG exist from a previous run on the MountSystemImg.sh

umount $SYSTEMIMG
kpartx -d $LOOP
losetup -d $LOOP

Modifying Files in the System.img

Once you have mounted the System.img script, above, you will be placed in a bash shell and located in the /mnt/elsystem directory. This directory represents the root of the System.img file and from here we can access the various files within, what will be, the vServers file system.

ls

One thing that we need to remember is to remove the / when editing files or creating links and so :

vi /etc/hosts becomes vi etc/hosts
vi /etc/fstab becomes vi etc/fstab

When creating links these must all be done as relative link so to set the System Time Zone we would normally execute:

ln -sf /usr/share/zoneinfo/GMT /etc/localtime

But this is replaced with:

cd etc
ln -sf ../usr/share/zoneinfo/GMT localtime

Packaging the Template

Once you have finished modifying the template it can be simply repackaged and then imported into EMOC as described in "Exalogic 2.0.1 Tea Break Snippets - Importing Public Server Template".

To do this we will simply cd to the directory above that containing the modified files and execute the following:

tar -zcvf <New Template Name>.tgz <New Template Directory>

The resulting.tgz file can be copied to the images directory on the ZFS and uploadd using the IB network.

This entry was originally posted on the The Old Toxophilist Site.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

The primary contributors to this blog are comprised of the Exalogic and Cloud Application Foundation contingent of Oracle's Fusion Middleware Architecture Team, fondly known as the A-Team. As part of the Oracle development organization, The A-Team supports some of Oracle's largest and most strategic customers worldwide. Our mission is to provide deep technical expertise to support various Oracle field organizations and customers deploying Oracle Fusion Middleware related products. And to collect real world feedback to continuously improve the products we support. In this blog, our experts and guest experts will focus on Exalogic, WebLogic, Coherence, Tuxedo/mainframe migration, Enterprise Manager and JDK/JRockIT performance tuning. It is our way to share some of our experiences with Oracle community. We hope our followers took away something of value from our experiences. Thank you for visiting and please come back soon.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today