30 Minute Deploy Session 1: CentOS 6.5 VM Template

By | March 11, 2014


What It Is:

The Community Enterprise Operating System (CentOS) is a freely available Linux distribution that is fully binary compliant with the approximate version of Red Hat Enterprise Linux. This means that it is basically the same as RHEL, although there is no formal support.

The fact that it is fully binary compliant makes it the perfect platform to test the many Open Source enterprise applications that are extremely popular in the “devops” space. Also, skills learned using CentOS will be directly transferable to a Red Hat based environment.

Why Do It:

The 15 Minute Deploy series here at vByron.com is designed to give any sysadmin the basic knowledge to create a functional lab on which to learn both emerging and established Open Source applications that are rapidly changing the business of the data center.

You won’t find hype or buzzwords (other than devops, but I like that one). What you will find in well documented, streamlined tutorials made to get you up and running fast with a base knowledge and links to further reading.

In the spirit of speed 15MD-001 will be the base for all future installs. At the end of this tutorial you will have a template that you can rapidly deploy so you can get right to the apps.

How To Do It:

Create The Virtual Machine

1. Download CentOS-6.5-x86_64-bin-DVD1.iso a CentOS mirror.

2. Log into the vSphere Web Client

3. Navigate to Storage.

4. Click “Upload a file to the Datastore”.

5. Select the CentOS ISO image.

6. Navigate to Virtual Machines

7. Right-click the Data Center and select “New Virtual Machine…” from the context menu.


8. Leave the default “Create a new virtual machine” selected. Click Next.


9. Name the VM and select the folder to place it in. Click Next.


10. Select the compute resource. Click Next.


11. Select the Datastore. Click Next.


12. Select the compatibility level. This is the virtual hardware version (ESX 5.5 is version 10). Click Next.


13. Select “Linux” for the Guest OS Family. Select “Red Hat Enterprise Linux 6 (64-bit)” for the Guest OS Version. Click Next.


14. Change New CD/DVD Drive to “Datastore ISO File” Select the CentOS ISO that you uploaded and click OK.


15. Click “Connect At Power On”. Click Next.


16. Confirm the Settings. Click Finish.


17. Wait for the Virtual Machine to be provisioned.

Install CentOS

1. Navigate to the newly created VM. Click the “Actions” drop down menu. Click on “Power On”.


2. In the same menu select “Open Console”.

3. By the time the console opens you should see the media test screen below. If not just wait a few seconds. Since we are using an ISO file there is no need to test to click “Skip”.


4. This next screen is the Welcome splash screen. Nothing to do. Click Next.


5. Select the Language for the Install. Click Next.


6. Select the Keyboard type. Click Next.


7. Keep the default “Basic Storage Device”. Click Next.


8. Click “Yes Discard My Data”.


9. Because this is going to be a template leave the hostname as “localhost.localdomain”. Click “Configure Network”.


10. Select “System eth0” and click Edit.


11. Click “Connect Automatically”. Click the IPv4 tab.


12. Configure the IP Settings as needed. Click Apply.


13. Click Close. Click Next.

14. Select the timezone. Click Next.


15. Set and Confirm the Root Password. Click Next.


16. Select Use All Space. Click Next.


17. Click “Write Changes to Disk”.


18. Wait while the disk is created and formatted.

19. Select the “Basic Server” package. Click Next.


20. Wait for the Install to complete.


21. Click Reboot to Finish the Installation.


Configuring the CentOS Template

1. Wait for the Virtual Machine to reboot then close the console.

2. Download and run PuTTY. PuTTY is a lightweight terminal client used to connect to hosts with the SSH Protocol.


3. Click “Yes” to accept the unknown host key.


4. Login as root.


5. Update the with the following command:

Note: The Virtual Machine will need internet access and name resolution.

yum update --skip-broken


6. Type “y” and “enter”.


7. Type “y” and “enter”.


8. The update is now complete.


9. Install git. We will need this in the future.

yum install git


10. Open the vSphere Web Client and navigate to the Virtual Machine that is being configured. On the Summary Screen click “Install VMware Tools”. Click “Mount” on the pop-up window.


11. Return to PuTTY.

12. Mount the VMware Tools ISO, copy the archive to HOME and extract the archive:

mount -t iso9660 /dev/dvd /mnt
cp /mnt/VMwareTools-9.4.0-1280544.tar.gz ~
tar -zxf VMwareTools-9.4.0-1280544.tar.gz


13. Unmount ISO and delete the archive:

umount /mnt
rm VMwareTools-9.4.0-1280544.tar.gz


14. Change Directory to vmware-tools-distrib/. Execute ./vmware-install.pl. When prompted press “enter” to accept all defaults.

cd ~/vmware-tools-distrib/


15. Create the initial firewall ruleset. This script will change the default to ACCEPT. This will make testing new apps much easier However it should not be used in production.

git clone https://github.com/byronschaller/deploy-devops.git
cd deploy-devops/
chmod +x firewall.sh


16. Open the /etc/udev/rules.d/70-persistent-net.rules for editing, add a “#” to the begining of every line.

nano /etc/udev/rules.d/70-persistent-net.rules


17. Save the file by typing “Control” and “o” together. Type “Enter” to verify the save.

18. Exit the program by typing “Control” and “x” together

19. Make the file read only.

chattr +i /etc/udev/rules.d/70-persistent-net.rules


20. Shutdown the virtual machine with the command:

shutdown -P now

21. The template preparation is now complete.

Create The Template

1. Open the vSphere Web Client and navigate to the CentOS Virtual Machine.

2. Right Click the Machine and select All vCenter Actions > Convert to Template.


Deploying a Virtual Machine from the Template

1. Right-click the template and choose “Deploy VM from this Template” from the context menu.


2. Name it and choose a folder. Click Next.


3. Select the Cluster for the Compute Resource. Click Next.


4. Select the Datastore. Click Next.


5. Select all three Check Boxes. Click Next

6. Click “New Guest Customization Spec”. Name it. Click Next.


7. Enter a Hostname and a Domain Name. Click Next.


8. Set the timezone. Click Next.


9. Select NIC1 and click the Edit (pencil) icon.


10. Manually assign the new IP address. Click OK. Click Next.


11. Enter the Domain and DNS Settings. Click Finish.


12. Select the newly created Spec. Click Next.


13. Delete the existing Network Adapter and create a new one. Click Next.


14. Review and Click Finish.


15. Wait for the new Machine to Deploy then Open the Console.

16. Login and verify your hostname and IP setting with the command ifconfig

17. Congratulations the new machine has been deployed!

3 thoughts on “30 Minute Deploy Session 1: CentOS 6.5 VM Template

  1. bookmark54

    Byron – I am using VMWare Player to install the .iso. I can’t see the “Back” and “Next ” buttons. I have to guess by using tabs – frustrating. How do I enlarge the VMWare Player install screen so I can see the entire CentOS splash screen for the install?

  2. zetret

    I want to clone a VMware VM (RHEL6.5), export it as an OVF and when
    someone deploys it again, I want them to enter custom information like
    IP, DNS, VM name in the vSphere Deploy wizard. How do I make this
    happen? (I’ve deleted the persistent net rules file) When I exported
    this template (created as you said) as OVF and tried to deploy from it,
    the customization wizard does not come up !

  3. Brandt Tullis

    Thanks for the great write-up. I altered one detail. I removed the network adapter from the VM before powering it on. I followed your guide except for altering the file in /etc/rules.d, and I didn’t install updates. Then, I powered off the VM, added a network adapter, and converted it to a template. This way, my VMs deployed from this template will have eth0 as their ethernet adapter.

    Altering the file in /etc/rules.d wasn’t achieving the desired results.


Leave a Reply

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