Create VMWare Teplate CentOS 6.5

In this article, I am going to outline a very basic and quick way to create a VMWare virtual machine template for provisioning CentOS (or RHEL) 6.5 in your VMWare environment. As I mentioned, this is a very basic configuration and does not take into consideration large scale deployments and is really intended as a starting point for a template for large scale production.


1. Perform the installation of CentOS Minimal as you would any Virtual Machine. Set the roo

2. Install perl by issuing the following command:

yum install perl

3. Install vmware tools. Accept all defaults during the VMWare tools installation:

mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
cp VMWare-tools-XXXX.tar.gz ~root
cd ~root
tar zxf VMWare-tool-XXX.tar.gz
cd vmware-tools
cd ..
rm –rf vmware-tools VMWare-tools-XXX.tar.gz

4. After the base install, update the OS by issuing the following commands:

yum update

5. Clean the yum cache by issuing the command:

yum clean all

6. To prevent hardware issues, remove udev persistent rules by issuing the following command:

rm –f /etc/udev/rules.d/70*

7. To prevent networking issues, remove the MAC and UUID of the NIC. New ones will be obtained upon clone:

sed –i ‘/*\(HWADDR\|UUID\)=/d’ /etc/sysconfig/network-scripts/ifcfg-eth0

8. Clearing out the logs on the server is also a good idea. This can be accomplished as follows:

NOTE: Where ‘?’ is usually the date but will depend on your logroatate.conf configuration.

logrotate –f /etc/logrotate.conf
rm-rf /var/log/*-???????? /var/log/*.gz
cat /dev/null > /var/log/audit/audit.log
cat /dev/null > /var/log/wtmp

9. Clear out all Temp directories as follows:

rm –rf /tmp/*
rm –rf /var/tmp/*

10. Now we will remove any SSH host keys for security:

rm-rf /etc/ssh/*keys*

11. For good measure, lets create an administrative user in case we need access later, after the root password has been changed by the user:

adduser admin
passwd admin

12. We want the root password changed upon booting up the server, so:

chage –d 0 root

13. We also do not want the new user to have a copy of what we have just done in the bash history, so lets wipe that out as well:

rm –f ~root/.bash_history

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.