Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (STEP 7)

STEP 7 – CREATE /etc/yum.repos.d/c7x64.repo for the CentOS 7 64-bit REPOSYNC CLIENTS:

note: client machine has to have nss-mdns (avahi-daemon) working, or file will need to be edited with server’s IP ADDRESS.

provide a copy of the file at “http://c7pxe.local/repos/client-files/c7x64.repo” from
folder “/var/www/html/repos/client-files/”

subsequent kickstart scripts will get this file during system installation.

# File:/etc/yum.repos.d/c7x64.repo
name=CentOS Base

name=CentOS EPEL

name=CentOS Extras

name=CentOS Updates


Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (STEP 6)

STEP 6 – build REPOSYNC and REPOTRACK commands for SCRIPTs (for getting filtered packages from BASE, UPDATES, and EXTRAS.
The same pattern works fine for EPEL, but I switched back to using REPOTRACK for EPEL, because I rarely utilize more than a few hundred MB of the EPEL packages and finally got around to parsing out a list.
  • “”    # for getting base, updates, and extras.
  • “”    # for getting base, extras

And, a REPOTRACK script for getting selected packages from EPEL:

  • “”

An easy way to begin using REPOTRACK is to query existing systems for what packages are installed from a given repo.  To gather my EPEL package list, I ran these two commands on all of my application servers:

  • repoquery -a –installed –qf “%{ui_from_repo} %{name}” | grep ‘^@epel’
  • repoquery -a –installed –qf “%-20{ui_from_repo} %-30{name} %-7{arch} %{epoch}:%-12{version} %-4{release}” | grep ‘^@epel’

Parse the results however you want, and you’ve got the basis for your repotrack script.  Repotrack doesn’t behave exactly like reposync, but it DOES get dependencies for packages, so it isn’t necessary to identify everything in advance.  It also works with wildcards.

Synchronize the directories for the repositories.
The –newest-only option puts only the latest version of each package in the repos.
note: “repoid” must match a repo name in “/etc/yum{$}.repos.d/{$}.repo”

For the “” script:

  • reposync –config=/etc/yumrsc7x64.conf –gpgcheck –plugins –repoid=base –newest-only –delete –downloadcomps –download-metadata –download_path=/var/www/html/repos/c7x64/
  • reposync –config=/etc/yumrsc7x64.conf –gpgcheck –plugins –repoid=extras –newest-only –delete –downloadcomps –download-metadata –download_path=/var/www/html/repos/c7x64/
  • reposync –config=/etc/yumrsc7x64.conf –gpgcheck –plugins –repoid=updates –newest-only –delete –downloadcomps –download-metadata –download_path=/var/www/html/repos/c7x64/

list the package URLs, but don’t actually download anything.

  • reposync –config=/etc/yumrsc7x64.conf –gpgcheck –plugins –repoid=base –newest-only –delete –downloadcomps –download-metadata –download_path=/var/www/html/repos/c7x64/ –urls

  • reposync –config=/etc/yumrsc7x64.conf –gpgcheck –plugins –repoid=extras –newest-only –delete –downloadcomps –download-metadata –download_path=/var/www/html/repos/c7x64/ –urls
  • reposync –config=/etc/yumrsc7x64.conf –gpgcheck –plugins –repoid=updates –newest-only –delete –downloadcomps –download-metadata –download_path=/var/www/html/repos/c7x64/ –urls
  • reposync –config=/etc/yumrsc7x64.conf –gpgcheck –plugins –repoid=epel –newest-only –delete –downloadcomps –download-metadata –download_path=/var/www/html/repos/c7x64/ –urls

Create (or update) new repodata for the local repositories. Note the option “-g comps.xml” to update the package group information.

  • createrepo /var/www/html/repos/c7x64/base/ -g comps.xml
  • createrepo /var/www/html/repos/c7x64/extras/
  • createrepo /var/www/html/repos/c7x64/updates/
  • createrepo /var/www/html/repos/c7x64/epel/

Do this so that clients will be able to read from the httpd repos:
chcon -R -t httpd_sys_content_t /var/www/html/repos/
Something about “SE Linux” according to a doc at RHEL.
Might throw errors, not sure if it has to be done *after* the first time RepoSync runs and populates the local repos, or if it doesn’t apply when the security settings on the vm are “permissive”.

For the “” script:

  • reposync –config=/etc/yumrsc7x32.conf –gpgcheck –plugins –repoid=base –newest-only –delete –downloadcomps –download-metadata –download_path=/var/www/html/repos/c7x32/
  • reposync –config=/etc/yumrsc7x32.conf –gpgcheck –plugins –repoid=extras –newest-only –delete –downloadcomps –download-metadata –download_path=/var/www/html/repos/c7x32/
  • reposync –config=/etc/yumrsc7x32.conf –gpgcheck –plugins –repoid=updates –newest-only –delete –downloadcomps –download-metadata –download_path=/var/www/html/repos/c7x32/
Create (or update) new repodata for the local repositories. Note the option “-g comps.xml” to update the package group information.
  • createrepo /var/www/html/repos/c7x32/base/ -g comps.xml
  • createrepo /var/www/html/repos/c7x32/extras/
  • createrepo /var/www/html/repos/c7x32/updates/

For the “” script:

The repotrack options are very similar to reposync:

  • –config=CONFIG      # defaults to /etc/yum.conf
  • –config=/etc/yumrsc7x64.conf
  • –arch=ARCH # defaults to “current arch” (whatever the systems is currently running at).
  • –repoid=REPOID # default is all enabled.
  • –download_path=DESTDIR # Path to download packages to.
  • –urls # only show download urls, don’t download files.
  • –newest # defaults to newest-only.

For my script, I’ve sorted commands/packages into common groups.  The script is literally the following commands and comments:

# common packages:
repotrack –config=/etc/yumrsc7x64.conf –repoid=epel –download_path=/var/www/html/repos/c7x64/epel/Packages/ –newest etckeeper htop nss-mdns epel-release

# security packages:
repotrack –config=/etc/yumrsc7x64.conf –repoid=epel –download_path=/var/www/html/repos/c7x64/epel/Packages/ –newest haveged tripwire fail2ban

# only for a Gui VM:
repotrack –config=/etc/yumrsc7x64.conf –repoid=epel –download_path=/var/www/html/repos/c7x64/epel/Packages/ –newest imlib2 openbox openbox-libs python2-pyxdg tweak yumex

# for python pypi … note: using “python36-pip” gets “python36, python36-libs, and python36-setuptools”.
repotrack –config=/etc/yumrsc7x64.conf –repoid=epel –download_path=/var/www/html/repos/c7x64/epel/Packages/ –newest python36-pip 

# for a DNS server:
repotrack –config=/etc/yumrsc7x64.conf –repoid=epel –download_path=/var/www/html/repos/c7x64/epel/Packages/ –newest dhcping 

# for a docker server… note: using “docker*” gets python dependencies; no need to type them all out.
repotrack –config=/etc/yumrsc7x64.conf –repoid=epel –download_path=/var/www/html/repos/c7x64/epel/Packages/ –newest docker*

# some git servers want/need this… note: using “github2fedmsg” gets dependencies; no need to type them all out.
repotrack –config=/etc/yumrsc7x64.conf –repoid=epel –download_path=/var/www/html/repos/c7x64/epel/Packages/ –newest github2fedmsg

# for a kitchen sink PYTHON36*…  using python36* gets a lot of stuff… including… numpy, pyvomi, pytests, requests, tkinter, virtualenv
repotrack –config=/etc/yumrsc7x64.conf –repoid=epel –download_path=/var/www/html/repos/c7x64/epel/Packages/ –newest python36*

# for more GIT* packages… includes items like gitolite, gitstats, git-extras, git-tools, 
repotrack –config=/etc/yumrsc7x64.conf –repoid=epel –download_path=/var/www/html/repos/c7x64/epel/Packages/ –newest git*

# for MYSQL* … fairly small list of items, some connectors, utilities, and some perl.
repotrack –config=/etc/yumrsc7x64.conf –repoid=epel –download_path=/var/www/html/repos/c7x64/epel/Packages/ –newest mysql*

# for SQLITE* … small list of items
repotrack –config=/etc/yumrsc7x64.conf –repoid=epel –download_path=/var/www/html/repos/c7x64/epel/Packages/ –newest sqlite*

createrepo /var/www/html/repos/c7x64/epel/

Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (STEP 5)

STEP 5 – configure an EXCLUDE LINE for the YUM CONFIG files:

nano /etc/yum.conf
  • exclude list, filters out stuff I don’t need to download:
  • this is the c7pxe list I’m using as of 2019-03-22.
  • NOTE: when we’re done with this setup, we’ll have a least three yum config files on this server:
    • 1) the regular /etc/yum.conf the OS uses.
    • 2) –config=/etc/yumrsc7x64.conf
    • 3) –config=/etc/yumrsc7x32.conf
in yum config files pulling packages for 64-bit instances:


# same exclude list with added line breaks for easier reading:


in yum config files pulling packages for 32-bit instances:




Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (STEP 4)

STEP 4 – CONFIG RepoSync/RepoTrack to support multiple OS Distros, Releases, and Architectures:

As of 2019-03-22, on c7pxe, the c7x64 and c7x32 repos take about this much space…
  • 4.0G /var/www/html/repos/c7x64/base/        # filter allows for GNOME desktop.
  • 206M /var/www/html/repos/c7x64/extras/
  • 942M /var/www/html/repos/c7x64/updates/
  • 187M /var/www/html/repos/c7x64/epel/
  • 3.4G /var/www/html/repos/c7x32/base/          # filter also excludes GUI desktops.

REPOSYNC OPTIONS (not all of them):
-c CONFIG, –config=CONFIG
             Config file to use (defaults to /etc/yum.conf).
  • CREATE extra YUM config files, one for each {Distro-Release-Arch} being sync’d:
    •  /etc/yumrsc7x64.conf # configure an exclude= line.
    •  /etc/yumrsc7x32.conf # configure an exclude= line.
  • CREATE extra YUM repo directory, one for each {Distro-Release-Arch} being sync’d:
    •  /etc/yumrsc7x64.repos.d
    •  /etc/yumrsc7x32.repos.d
  • CREATE matching repo files under each directory:
    • /etc/yumrsc7x64.repos.d/c7x64.repo # {base,extras,updates,epel}
    • /etc/yumrsc7x32.repos.d/c7x32.repo # {base,extras,updates}
  • EDIT each YUM config files to specify where to find it’s “*.repo” files:
    •  IN “/etc/yumrsc7x64.conf”, add the line “reposdir=/etc/yumrsc7x64.repos.d
    •  IN “/etc/yumrsc7x32.conf”, add the line “reposdir=/etc/yumrsc7x32.repos.d
  • define reposync CONFIG OPTION for each {Distro-Release-Arch} being sync’d (for the reposync script(s):
    •  –config=/etc/yumrsc7x64.conf
    •  –config=/etc/yumrsc7x32.conf
-a ARCH, –arch=ARCH
              Act as if running the specified arch (default: current arch,
              note: does not override $releasever. x86_64 is a superset for
  •  –arch= # can skip this option/flag for the x64 version, default already works.
  •  –arch= # for the x32… I’m not sure whether it is supposed to be “i386”, “i686”, or something else.
    • note: 2019-03-22, seems to working without actually using this flag.
-r REPOID, –repoid=REPOID
              Specify repo ids to query, can be specified multiple times
             (default is all enabled).
  • This flag refers to the [repo name] in the configured “*.repo” files.
  • “REPOID” must match a name in the targeted /etc/yum{$}.repos.d/{$}.repo file(s).
  • So, if you keep the names simple there, then this flag remains much simpler.
  • the options used by my repo configs and reposync/repotrack scripts:
    •  –repoid=base
    •  –repoid=extras
    •  –repoid=updates
    •  –repoid=epel
-d, –delete
              Delete local packages no longer present in repository.
 -p DESTDIR, –download_path=DESTDIR
              Path to download packages to: defaults to current directory.
  • My local repos are being stored/served in these locations (don’t put this syntax in the script):
    • /var/www/html/repos/c7x64/{base,extras,updates,epel}
    • /var/www/html/repos/c7x32/{base,extras,updates}
  • note: the reposync utility will make (or use existing) subfolder(s) matching the repo name, so, my reposync scripts only need:
    • –download_path=/var/www/html/repos/c7x64/
    • –download_path=/var/www/html/repos/c7x32/
-u, –urls
              Just list urls of what would be downloaded, don’t download.
-n, –newest-only
              Download only newest packages per-repo.

Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (STEP 3)


note: if vdisks are “SATA”, this should display “sda”, if vdisks are “NVMe” this should display “nmve0n1”
[root@c7pxe elmer]# lsblk # show partition layout (before config’d 2nd disk):
sr0              11:0    1 1024M  0 rom
nvme0n1         259:0    0    8G  0 disk
├─nvme0n1p1     259:1    0  512M  0 part /boot
└─nvme0n1p2     259:2    0  7.5G  0 part
  └─centos-root 253:0    0  7.5G  0 lvm  /

  • configure the 2nd disk: 20GB for “reposync” files (was using 30GB, but didn’t need it all):
    • start up the vm.
    • if NVME:
      • fdisk -l # new disk is listed as ” Disk /dev/nvme0n2: 32.2 GB, 32212254720 bytes, 62914560 sectors “
      • fdisk /dev/nvme0n2 # select new “n“, primary “p“, partition number “1“, first sector ‘default‘, last sector ‘default‘, write “w“.
      • fdisk /dev/nvme0n2 # select change type “t“, linux lvm ‘8e‘, write ‘w‘.
      • mkfs.xfs -f /dev/nvme0n2  # for some reason, the VMware Fusion VMs with NVMe vdisk required the extra “-f” flag for this to work.
    • or, if SATA:
      • fdisk -l # new disk is listed as “Disk /dev/sdb: 32.2 GB, 32212254720 bytes, 62914560 sectors”
      • fdisk /dev/sdb # select new “n“, primary “p“, partition number “1“, first sector ‘default‘, last sector ‘default‘, write “w“.
      • fdisk /dev/sdb # select change type “t“, linux lvm ‘8e‘, write ‘w‘.
      • mkfs.xfs /dev/sdb1
mkdir /var/www/html/repos   # httpd must be installed and 2nd disk must be ready.
mount /dev/nvme0n2 /var/www/html/repos
            # if SATA: mount /dev/sdb1 /var/www/html/repos
nano /etc/fstab # add new line,
            # “/dev/nvme0n2 /var/www/html/repos xfs defaults     0   0
reboot # verify that mounts, folders, and httpd work after a reboot.
[root@c7pxe elmer]# lsblk # show partition layout:
sr0              11:0    1  7.8G  0 rom
nvme0n1         259:0    0    8G  0 disk
├─nvme0n1p1     259:1    0  512M  0 part /boot
└─nvme0n1p2     259:2    0  7.5G  0 part
  └─centos-root 253:0    0  7.5G  0 lvm  /
nvme0n2         259:3    0   20G  0 disk /var/www/html/repos

cd /var/www/html/repos/

from a browser, check that is providing a web page (apache default).
check that the /home/elmer/ script has the lines for “/var/www/html/repos“.
  • mkdir -p /var/www/html/repos/{c7x64,c7x32} # or whatever list of distros to serve.
  • mkdir -p /var/www/html/repos/c7x64/{base,extras,updates,epel}
  • mkdir -p /var/www/html/repos/c7x32/{base,extras,updates} # there is no epel for c7x32.
  • mkdir -p /var/www/html/repos/client-files/ # will serve scripts/files here, for post install uses.
optionally: to serve ISO images to PXE boot clients:
  • mkdir -p /var/www/html/repos/c7x64/ISOminimal
    • # use: mount /dev/cdrom /var/www/html/repos/c7x64/ISOminimal
  • mkdir -p /var/www/html/repos/c7x64/ISOeverything
    • # use: mount /dev/cdrom /var/www/html/repos/c7x64/ISOeverything
  • mkdir -p /var/www/html/repos/c7x32/ISOminimal
    • # use: mount /dev/cdrom /var/www/html/repos/c7x32/ISOminimal
  • mkdir -p /var/www/html/repos/c7x32/ISOeverything
    • # use: mount /dev/cdrom /var/www/html/repos/c7x32/ISOeverything
enable remote machines to read from httpd server on c7pxe.local:
chcon -R -t httpd_sys_content_t /var/www/html/repos/
      # something about “SE Linux” according to a doc at RHEL.
      # that may throw an error, but it may not be relevant on c7pxe with selinux=permissive
      # or? might have to wait until after it’s ran a reposync cycle, so there is content in the folders.

Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (STEP 2)



yum install httpd             # downloads 3.0 M, installs 10 M.
yum install tftp-server   # provides initial boot image to the client. Pulls about 44K from repo=base.
yum install syslinux       # provides bootloader to clients. Pulls about 1.2MB from repo=base.
yum install nfs-utils       # downloads 1.5 M, installs 4.2 M.
yum install createrepo  # Installs “createrepo” and “python-deltarpm”, downloads 125K, installs 348K.
systemctl start httpd # 1st run will automatically create /var/www/html/
systemctl enable httpd # verify the apache default web page is available at

Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (STEP 1)

STEP 1 – clone an existing “minimal” VM (or build one).

This step requires an existing “minimal/baseline” VM ready to clone.

If you don’t have one, install/configure a CentOS version 7 64-bit instance.

  • On MacOS/Fusion:
    • clone an existing baseline VM.
    • verify VM config: 1 vcpu, 512MB mem, 6g NVMe disk, 1 network interface (VMNET2).
    • verify VM config: disable/remove Printer, Sound, USB, Camera, Bluetooth.
    • update shared folder settings, VM name, and notes.
  • In VM:
    • use nmtui to set/rename hostname and set static IP.
    • pull scripts and config files into /home/elmer from /mnt/hgfs/c7pxe
    • * many of these scripts and config files are described in following steps.
    • yum repolist # => should be using online CentOS-7-64bit: base,updates,extras,epel
    • systemctl status kdump # => check and confirm it’s disabled
    • free -h  # “Swap: 0B 0B 0B” # => check and confirm it’s all zeros (ie., swap is disabled).
    • hostname; ip address; uname -r
    • yum update
    • List all of the installed packages (RPMs) with size info, and sort the list by size:
    • rpm -qa –queryformat ‘%10{size} – %-25{name} \t %{version}\n’ | sort -n
    • ./ # note: my custom script for cleaning up after yum.
    • ./ # note: my custom script for cleaning up and shrinking virtual disks.
  • On MacOS/Fusion:  shut down the newly cloned VM and ZIP a baseline backup before continuing.

Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (introduction)

INTRODUCTION:  Overview of the starting point for this install, and reasons why to do it.
I’ve been building/tweaking baseline CentOS installs for quite awhile. For CentOS 7 64-bit, I’ve “standardized” on a config that uses ~550 MB of vdisk and runs in ~ 120 MB of vRAM (512 MB allocated to the VM).
  • CentOS 7.x Linux 64-bit, NO GUI desktop, HTTPD, PXE, Kickstart, RepoSync+RepoTrack, NFS.
  • Begin with by making a full clone from existing VM c7baseline.
  • two vDisks:
    • 20GB for RepoSync at “/var/www/html/repos/” hdd=”c7pxe-repos.vmdk”
    • 6GB for /boot and “/” hdd=”c7baseline-d1.vmdk”
  • entry for “/etc/hosts”: c7pxe.local c7pxe
  • VM is configured with a static IP using VMware Fusion VMNET2
  • Only user is “elmer”.  Elmer has administrative (sudo) privileges.

This baseline has:
  • SELinux=permissive
  • firewalld is enabled and configured, with only SSH and nss-mdns in from local subnet.
  • repo EPEL is enabled.
  • KDUMP and SWAP were disabled during install.
  • has these packages: ip address, nmtui, gzip, tar, top, curl, epel-release, yum-utils, deltarpm, nano, nss-mdns, htop, rng-tools, rsync.
  • Avahi is running, so I can use *.local name resolution and skip more complicated DNS and/or host file configurations.
  • open-vm-tools is running. I have a couple folders shared into the VM for getting scripts and outputting config backups.
  • SSHD is running.  I do most of my activity via a host MacOS terminal ssh connection.
  • I use nano as editor on CentOS VMs.  If you prefer vi, emacs, or something else… thats ok with me.
  • The VM gets TIME from the host, via hypervisor/open-vm-tools, so it doesn’t need NTP or Chrony.
  • Virtual hardware items Printer, Sound, USB, Camera, and Bluetooth have been removed from the VM config.
  • The VM using NVMe for hard disks and SATA for cdrom.  No IDE or SCSI.
  • The reduced hardware profile enables removing a lot of firmware packages from these VMs.

It’s easy/fast to make a ZIP backup copy of an entire VM, so I’m moderately aggressive with removing things like dracut emergency/rescue packages, old kernels, yum caches, etc.  If I break a VM, I just revert to a previous backup.

With VMs under 20GB in size, making ZIP backups via the host OS filesystem is often faster than managing VMware snapshots.  Also, I like knowing that I have fully contained/atomic backups set to the side and quickly available if needed.

I have some custom scripts that clean up the VM contents and shrink the vdisk (to reduce disk usage on host system).

There are many options to further minimize and harden these VMs, but this current baseline maintains normal CentOS/Fedora/RHEL/Oracle functionality and compatibility.

Using a local RepoSync + RepoTrack enables installs/updates without internet for the target nodes, it speeds up the install/update time for all of the VMs, and it provide much better awareness/control over what packages are getting installed.
Using PXE/Kickstart automates a lot of the tedious/repetitive installation activities.  Doing kickstarts from local repos eliminates the need for maintaining a collection of downloaded ISOs.
An instance installed from ISO immediately needs updates; but kickstart from local repos takes care of that during the initial install.
Additionally, kickstart can run “%POST” activities to perform more setup/config work, even installing and fully configuring software applications.

Build a CentOS7 server for: pxe boot, kickstart, reposync, repotrack, nfs, https (summary of steps)

  • INTRODUCTION:  Overview of the starting point for this install, and reasons why to do it.
  • STEP  1 – clone an existing “minimal” VM (or build one).
  • STEP  2 – prepare to install/config PXE/RepoSync/RepoTrack (load software packages).
  • STEP  3 – add/config a 2nd virtual hard disk for the repo files.
  • STEP  4 – CONFIG RepoSync/RepoTrack to support multiple OS Distros, Releases, and Architectures.
  • STEP  5 – configure an EXCLUDE LINE for YUM CONFIG files
  • STEP  6 – build REPOSYNC commands for SCRIPT “”
  • STEP  7 – CREATE /etc/yum.repos.d/c7x64.repo for the CentOS 7 64-bit REPOSYNC CLIENTS
  • STEP  8 – CREATE /etc/yum.repos.d/c7x32.repo for the CentOS 7 32-bit REPOSYNC CLIENTS
  • STEP  9 – ENABLE and CONFIGURE PXE (uses vmware dhcp; does not require CentOS NTP/DHCP/DNS/vsftd/xinetd)
  • STEP 10 – Create a PXE BOOT MENU
  • STEP 11 – create the kickstart files referenced by the PXE Boot menu:
  • STEP 12 – Put the required PXE client boot files in place.
  • STEP 13 – Provide PXE boot server info to DHCP clients, via VMware Fusion vnet config (not a CentOS DHCP server).
  • STEP 14 – Test PXE Boot and Kickstart installation.
  • SIDEBAR 1 – Alternate ways to provide PXE BOOT IMAGES to clients (a brief summary)
  • SIDEBAR 2 – Optional NFS SHARE: convenient for exploring repo contents from a gui desktop VM.
  • SIDEBAR 3 – PXE client note re memory:  the boot image uses a ramdisk.

Reduce size of guest vmdk disks with VMware Fusion 4.1.3 on OS X 10.8

When running multiple VMs, and keeping backup copies of various configs, a considerable amount of disk space can be used quickly.  The following steps have been confirmed to reduce disk usage for several virtual machine guest operating systems.

  • Oracle Linux R6 U3 64-bit
  • centOS 6.3 64-bit
  • Ubuntu 12.04 LPS 64-bit
  • openSUSE 12.1 64-bit
  • Mac OS X (multiple versions)

Oracle Linux R6 U3 and CentOS 6.3:  *these steps utilize a desktop environment and VMtools.

  1. remove any unneeded apps/packages, files, etc and empty the trash.
  2. clean up the YUM package files with (terminal commands as root):
    1. yum clean packages
    2. yum clean metadata
    3. yum clean dbcache
    4. (or) yum clean all
  3. at the command line, type “vmware-toolbox” to launch the VMware Tools GUI within the guest VM.  This is equivalent to the GUI available within Windows guests.
  4. Select the drive (partition) to Shrink.  1st the utility will prepare the drive for the shrink process and then a final dialog box will be presented to begin the shrink drive operation.

Ubuntu 12.04 LPS:  same as described for centOS and Oracle Linux, except the YUM commands are replaced with:

    1. sudo apt-get autoclean
    2. (or) sudo apt-get clean
    3. (0r) sudo apt-get autoremove

*note: Ubuntu 12.04 utilizes the Ubuntu Software Center for GUI application management (and has the annoying characteristic of only working with one selection at a time); installing the “Synaptic” package manager provides a more traditional Linux package manager.

openSUSE 12.1:  same as described for centOS and Oracle Linux, except YAST handles the package and cache cleanups (instead of yum or apt-get).  Options are available within the YAST GUI.

OS X:  10.6 Snow Leopard, 10.7 Lion, and 10.8 Mountain Lion (including servers).

  1. remove any unneeded apps, files, etc and empty the trash.
  2. using Finder, navigate to the following folders and remove unneeded fonts and dictionary files for languages you’re certain you won’t need for this VM.  Sort the folder contents by size and select the largest.  You can verify font files by opening them in the “font book” app to preview.
    1. /System/Library/Fonts/
    2. /Library/Dictionaries/
    3. /Library/Fonts/
    4. note: sometimes the system will state a font is in use and need a restart before allowing all of the deleted fonts to be emptied from the trash.
  3.  use the utility Monolingualto remove unneeded Architectures, Input Types, and Languages from OS X and installed application packages.
    1. If you know you have an app which needs to be excluded, use the Monolingual “Preference” to add the app’s location to a list of excluded directories.
    2. in the main app, use the “Languages” tab to select which languages to remove (be sure to scroll the entire list and de-select any you wish to keep).  On a fresh install of OS X 10.8 Mountain Lion, selecting all but English, French, and Spanish removed about 1.6GB
    3. use the “Input Menu” tab to select what to remove.
    4. use the “Architectures” tab to select what to remove.
    5. note: Monolingual only removes the items in the visible tab; if you desire to remove items from all three tabs, you’ll need to run it three times.
  4. use the disk utility app (within the VM) to erase free space on the disk.
  5. close the VM and exit VMware Fusion
  6. use the vmware-vdiskmanager utility to shrink the VMDK.
    1. open Finder, browse to the stored VM, right click and show package contents, locate the file “your-vm-name-here.vmdk”.
    2. open Terminal and CD to “/Applications/VMware\ Fusion/Contents/Library/”
    3. type “./vmware-vdiskmanager -k “
    4. drag the VMDK file from Finder to Terminal (this will append the file path and name to the command.
    5. In terminal, enter the command to shrink the vmdk.