Skip to content

Instantly share code, notes, and snippets.

@pleckey
Created July 15, 2013 00:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pleckey/5996774 to your computer and use it in GitHub Desktop.
Save pleckey/5996774 to your computer and use it in GitHub Desktop.
Minimize Ubuntu vagrant box size for packaging
#!/bin/bash
##
# Run as sudo, then exit and package immediately
##
# Remove unnecessary packages
aptitude purge ri
aptitude purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude purge python-dbus libnl1 python-smartpm linux-headers-2.6.32-21-generic python-twisted-core libiw30
aptitude purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5
# Cleanup any other packages
aptitude clean
# Zero free space to aid VM compression
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment