I have created a new post here that details the most up to date information for CentOS 7.x Templates.
Following the instructions below will yield a template ready for future installs that ensures you can deploy at speed.
All told this should take no longer than 15 minutes to complete.
I have amended the post with details on how to fix the guest customisation issues that I was experiencing before.
I can now successfully deploy new VM’s from the template.
Creating the VM
As a fan of the C# client I have used that for the process of creating the CentOS 7 Template, obviously if you want to do this via the web client you’re more than welcome to do so.
Use Ctrl + N to open the New Virtual Machine wizard.
Accept the Typical configuration and click Next
Enter the name of the template and click Next
Select your Resource Pool and click Next
Select your Datastore and click Next
Choose your OS type and version, click Next
Choose your Network and change your adapter type if required, the VMXNET3 driver is present during the installation process and is the default card, click Next
Choose your disk provisioning policy and click Next
Click the Edit VM settings box
Browse to your ISO file, click Connect at power on and then remove the floppy drive, click Finish
Installing CentOS 7
Now we have the VM created we need to install the OS, select the VM, open the console and hit the green arrow to power on
Click in to the VM and use the up cursor to skip the Media Test and select Install CentOS 7
Choose your default language and locale, click Continue
Select Software Selection
I chose Infrastructure Server as this looks to be the replacement for the older Basic Server install that a lot of people defaulted to. Click Done
Select Installation Destination
Click Network & Hostname
Toggle the On\Off switch so that you’re connected. All being good when you chose your network (and you have DHCP active on your network) you should get an address, if you don’t click on the Configure button and enter the IP addressing details there. I have left the hostname as the default setting as this will be changed during deployment. Click Done
Click Begin Installation
Select Root Password
Enter your default password twice, click Done
Wait for the installation to finish
Installing CentOS 7 Software Updates and Open-VM-Tools
Using either Putty or the console log in to the server
Here I am still using the VM Console to access the VM
Login as root
Now we are going to install updates using yum.
Type yum update –skip-broken
skip-broken is a feature in yum to skip packages that have dependency problems or introduce problems to the installed packages
Type y when prompted to download the updates.
Update complete, now on to installing open-vm-tools
As this VM is being built to create a template from we need to add an additional VMware tools plug-in.
First we need to import the VMware Keys.
Using the curl command to download the two files to a directory
curl –o filename.ext http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub
curl –o filename.ext http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub
You then need to import the keys, you need to repeat the command twice.
rpm --import /key_path/key_name
Once that’s done we need to use nano to create the following file
The file needs to contain the following information
name = VMware Tools
baseurl = http://packages.vmware.com/packages/rhel7/x86_64/
enabled = 1
gpgcheck = 1
Type Ctrl x to save and exit.
Now we need to install the additional plug-in.
Type yum install open-vm-tools-deploypkg
Installation completed. Time to restart the service
systemctl restart vmtoolsd
After the service restart we can see that VMware Tools is now reporting in.
Finally before we power off to convert it to a template we need to make some final changes, this change forces vCenter to think that this is a RHEL 7 VM rather than CentOS 7 which allows the VM to run the guest customisation during deployment.
Currently if you run cat /etc/redhat-release you will get the following response
What we want to see is
This forces guest customisation to be run thinking the OS is RHEL7 and thereby allowing guest customisation during deployment.
To make the change run the following command
rm -f /etc/redhat-release && touch /etc/redhat-release && echo ‘Red Hat Enterprise Linux Server release 7.0 (Maipo)’ > /etc/redhat-release
The above command was found via the http://serverfault.com/questions/653052/from-vsphere-5-5-deploying-centos-7-from-template-ignores-customizations website so thanks guys.
We are now ready to power down the VM.
Type shutdown –P now this will shutdown and power off the VM.
Finally we are going to convert it to a template.
In the C# client browse to the VM Summary page and click on Convert to Template