RHEL Template for vmware

Latest response

Hello all!

I'm a fairly new Red Hat admin coming from an HP-UX background. We are starting to migrate our oracle work loads from physical HP-UX hosts to virtualized RHEL 6.6 servers. I need to create a template that I can use to roll out new servers pretty quick and I was planning to use the steps outlined here:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Virtualization/3.0/html/Evaluation_Guide/Evaluation_Guide-Create_RHEL_Template.html

I guess I was surprised at how short the document was and thought I would toss this out to the community to see what other's were doing. Also, I have attached a subscription to the template image for patching purposes. I'm assuming I should remove that before converting the image to a template?

Thanks,

Jeff

Jeff Davis's picture

Responses

In general, we don't use RHEV for virtualization. The methods for template-creation vary by virtualization-platform, but the basics are the same (and short). Where the processes become a lot more involved (and truly varied) are in the template-launch methods. If you're in a multi-virtualization environment, you're going to want to look at tools like cloud-init and into cross-environment orchestration engines.

Hey Jeff,
Myself, I came from a Solaris background using jumpstart and FLARs. I assume you are comfortable with the "Golden Image" approach I would hear the HP-UX and AIX folks talk about ;-)

The following are a good place to start:
https://access.redhat.com/solutions/271643
https://access.redhat.com/solutions/198693

I also reference the RHEV doc you have listed in your original post. The key points (which are covered in the docs) are to remove any non-generalized identity information that may cause conflicts later. I.e. do not allow duplicate systemIDs for RHN - as you mentioned, remove the MAC address so that "eth0" is utilized post-build, etc..)

Hi Jeff,

What are you using a Hypervisor (Virtualization layer)?
RHEV, VMware ESX or any other product?

The article you refer to is written for RHEV, even though it should work 99% out of box for VMware ESX too, only the picture are a little different.

Kind regards,

Jan Gerrit Kootstra

Hi Jeff I had the same thoughts when establishing a health emergency system with around 40 identical servers.
The business required fast VM rollout.
I ended up installing the VM using a kickstart file. Since we don't have a Satellite (yet) I've created a floppy image and installed using the "Run Once" function in RHEV.
After the installation, checked if OS is as expected, and sealed the Vm to template using a script which is placed in /tmp during the kickstart installation:
#!/bin/bash

# Sealing machine for template
/bin/rm -f /etc/ssh/ssh_host_* /etc/udev/rules.d/70-* /etc/sysconfig/rhn/systemid
/bin/sed -i '/UUID/c\UUID=' /etc/sysconfig/network-scripts/ifcfg-eth0
/bin/sed -i '/HWADDR/c\HWADDR=' /etc/sysconfig/network-scripts/ifcfg-eth0
/bin/rm -f /root/.bash_history
/bin/find /var/log/ -type f  -exec rm -f {} \;
/bin/touch /.unconfigured
/bin/rm -f /root/.bash_history

#  Cleanup
/bin/rm -f /tmp/seal_to_template.sh /tmp/ks-script*
/sbin/shutdown -h now
Could probably look a bit more professional but then again, it works.
After this, the Vm turns off, I remove the nic and with right click in RHEV-M "Make Template"
I'm using NFS Export Domain to place the Template in different Data Centers.
And the Template is configured with Thin Provisioned disk to keep it as small as possible. When rolling out VM I just choose Preallocated disks.

You want to be careful with summarily nuking files under /var/log when sealing a template, You need to ensure that your syslog service can be configured to create files with the correct mode and ownership (and that you've done the steps to do so). Failure to do this can mean that log files not existing at the time of service start will cause the logging daemon to not record desired log entries. For the sake of daemon-to-daemon portability, you might be better off doing something like /bin/find /var/log/ -type f -exec cat /dev/null > {}\; instead.

Hi Tom

Great and Thanks a lot for pointing out. Didn't really think of that.
I will immediately replace as you suggested and test.

Hi Tom

Tested and had some trouble getting it to work.
So ended up with,

/bin/find /var/log/ -type f -exec /bin/sh -c '>{}' \;

which in fact cleared all files instead of nuking them.
Great and again...thanks for for pointing it out.

This is an excellent suggestion as nuking /var/log contents will also break functionality of things like lastlog (which it doesn't recover from without manual intervention).

Thanks for all of the comments! Very helpful stuff. We are running ESXi 5.5. I followed the steps in one of the articles James posted: https://access.redhat.com/solutions/198693 Between that and choosing the customize option when deploying from the template it seems to be working great!! Our DBA pre-installed the oracle binaries as part of the image and I spawned off a VM yesterday using it. He says everything is working so far, though some kernel tunables and ulimits needed tweaked. I will likely update the template again with some kernel tunables and ulimits for oracle and I like that script along with the idea of clearing the log's in /var/log too.

Any Adjustments for RHSM? Might as well as unregister the server before we make the clone. Esp since RHN is dead.

Edit: seehttps://access.redhat.com/solutions/198693

Was this helpful?

We appreciate your feedback. Leave a comment if you would like to provide more detail.
It looks like we have some work to do. Leave a comment to let us know how we could improve.
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.