This has been very painful and frustrating. So I am very happy I figured it out and can share it with you! I hope that this helps you avoid the fuss I had.
Things to gather
You will need the media – Centos 7 in my case and uploaded where you can find it easily. Incidentally I used Centos 7.0 and vSphere 5.5 U2 and everything patched to current (updated for vSphere 6.0 and Centos 7.0 1611).
Steps – Install
- You need to create a VM of the type Redhat Enterprise 7 64-bit.
- Do a basic Centos 7 install. I kept all the defaults, but had to confirm the disk, pick the right TZ, and add a good root password. BTW, when you do the TZ, also enter Network and toggle it on – you should see a DHCP address.
- Update the OS with the following command.
I had some issues in that networking did not work. There were two things wrong – NETWORKING=YES did not exist and ONBOOT=No did exist. You can find out more on this subject in this article.
- You should do a copy and paste of this long command and execute it at the command prompt:
rm -f /etc/redhat-release && touch /etc/redhat-release && echo "Red Hat Enterprise Linux Server release 7.0 (Maipo)" > /etc/redhat-release
- we need to add a few typical things to the OS.
yum install wget
yum install bzip2
yum install perl
yum install net-tools (likely already installed)
It is possible that with 1611 of 7.0 this section is not needed. I did work through it and things were ok, but stuff was already in place so that makes me think it is not needed but will need to test.
- Download the VMware package certs from here – http://packages.vmware.com/tools/keys . It will look like this.
- You should copy them to /tmp
- Now we need to load those certs.
rpm –import /path/key_name.pub
- Now create a text file
- With the following contents
enabled = 1
gpgcheck = 1
- This file and contents will look like below.
- We may, or may not need to install the open-vm-tools package.
yum install open-vm-tools (likely already installed)
- Now we need to load the package that will do customization.
yum install open-vm-tools-deploypkg (something newer likely already installed so this step not needed)
This should look like the below image.
- The certs we installed is what lets it be installed successfully.
You should be able to turn the VM into a template and deploy from it successfully.
Note about how the VM name is test7, and the DNS name is test7.dglabs.com. For so many tests the DNS name said centos.tmpl as it was the template name and wasn’t being updated.
Further Customization of your Linux Image
Just like I do a lot of tweaks to my Windows if you are a Linux Admin you would do the same.
You can find a really good long list of tweaks in this article.
You can find a good short list of tweaks in this article.
At this time I am not using any of these tweaks but when I do I will update this section of the article.
If your deploy from template is not successful, like mine was, meaning that the template name remained and the VM name was not taken by the VM, you should check the following folder and file for clues.
I found in mine:
deployment result = 127
Which means Perl is not installed (so I had to update this article again!)
If you try and install the deploypkg and get an error like below you are missing the VMware certs.
How to get the certificates to your VM?
I had problems with this, so I used wget. Which is why I added it to the list above! And that worked great. See below for an example.
None of these alone helped. But bits of all of them helped a lot!
Lone Sysadmin – http://lonesysadmin.net/2013/03/26/preparing-linux-template-vms/
VMware Centos OS 7 doc – http://partnerweb.vmware.com/GOSIG/CentOS_7.html
VMware KB article on installing deployPkg – http://kb.vmware.com/kb/2075048
With this info you should be successful in building out a Centos template for use in your VMware environment and without all the issues that I had. I am not a linux guy so I might have more info here in this article then necessary but I can tell you it works!
Thanks and have a great day!
- 7/21/17 – this article has a much easier way to do VMware tools in CentOS. This article has some nice troubleshooting info.
- 1/11/17 – doing this with vSphere 6.0 U2. I also used the Centos 7 1611. Added a bit of detail above to help out.
- 8/12/15 – Saw this great article for doing something similar in Red Hat.
=== END ===