STC – CentOS Minimal Virtual Machine Creation Guide

This document will cover the steps required to create a CentOS Minimal virtual machine in a VMware vSphere environment. The idea is that there are a great many application and/or server roles that can leverage CentOS but they all require a base server. Rather than using the standard CentOS install, this guide will use the Minimal release as less is more especially in a home lab.

Server Build Information:

Normally this section would explain the virtual hardware requirements (vCPU, RAM, Hard Disk, etc). Since the server’s workload would dictate those requirements, this guide will use a simple baseline as follows:

CentOS Miminal 6.3 iso
1 vCPU
512mb RAM
16GB Hard Disk (thin-provisioned)
VMXNET3
VMware Paravirtual SCSI Controller (PVSCSI)

Once the VM is created, mount the CentOS Minimal 6.3 iso to the VM, remove the floppy drive device, and set to boot into the BIOS. In the BIOS, navigate to the Advanced tab, IO Device Configuration.

Disable all four devices listed.

Now save and exit the BIOS and let the VM boot into the CentOS installer. It is my experience that with 1GB RAM, the graphical installer can run. With less memory the ncurses text-based installer will be used.

During the install process, the key items to note will be regarding hard disk partitioning. This guide uses the default of ext4 and a single disk. Re-initialize the disk:

Next make sure to select “Use entire drive”

Writing the changes to disk will then all the installer to proceed with the installation tasks. When complete, login as root. Networking must be first setup:

Edit /etc/sysconfig/network-scripts/ifcfg-eth0 (or whatever nic is required) using vi to look like the following sample:

DEVICE=eth0
HWADDR=08:00:27:0b:9a:f7
NM_CONTROLLED=no
ONBOOT=”yes”
IPADDR=192.168.1.10 [sample ip]
BOOTPROTO=none
NETMASK=255.255.255.0
DNS1=192.168.1.1
DNS2=192.168.1.2
USERCTL=no
TYPE=Ethernet

Next, enable the network service on startup “chkconfig network on” and then restart the service “service network restart”

Next, confirm DNS servers are in /etc/resolv.conf. Add any additional at this time using this format:

nameserver xxx.xxx.xxx.xxx

Next make sure to set the default gateway and hostname. Edit /etc/sysconfig/network and include the following:

HOSTNAME=xxxxx
GATEWAY=xxx.xxx.xxx.xxx

Now reboot and test connectivity to the internal network and also to the internets (those cats aren’t going to look at themselves!).

Once testing is complete, now it’s time to install the packages needed to install VMware Tools (if you are into that sort of thing). There are some prerequisite packages that are required first, and it’s a good idea to update your CentOS install with the latest packages at this point.

Run as root “yum update” to go out and grab the updated repo and package lists. It will prompt for y/n to update. Likely there is a kernel update so a reboot should be performed.

Once the update is complete, install all prerequisite packages needed for VMware Tools using “yum install wget sudo postfix perl kernel-headers make gcc ntp system-config-firewall-tui”.

To note: the VMXNET3, PVSCSI, and VMMEMCTL kernel modules are already baked into the CentOS 6.x series so installing VMware Tools will not replace those by default. To remove those, run the VMware Tools installer with the –clobber-kernel-modules= vmxnet3, pvscsi, or vmmemctl to overwrite.

Now, install VMware Tools through the vSphere Client.

Mount the ISO and copy the package to the /tmp directory.

“mount -t iso9660 /dev/cdrom /mnt” and “cp VMwareTools.tar.gz /tmp”

and remove the VMware Tools cd “umount /mnt”

Now, unpack the VMware Tools gzip “tar -zxvf VMwareTools.tar.gz” and drop into the unzipped folder to install by running “.\vmware-install.pl”

Once the install is complete, reboot again and tools should be running and happy in the vSphere Client.

To note, I have not tested overwriting the baked in VMXNET3, PVSCSI, and VMMEMCTL modules but perhaps it’s worth investigating?

At this point, the base virtual machine for CentOS Minimal is complete.