Created
August 27, 2013 18:13
-
-
Save waako/6357021 to your computer and use it in GitHub Desktop.
cleaning up vagrant box before packaging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guest$ vagrant ssh | |
vagrant$ sudo su | |
# Total upgrade | |
apt-get update && apt-get upgrade | |
apt-get dist-upgrade | |
# Ensure the box is minimally provisioned | |
apt-get -q -y install puppet zerofree | |
# This seems too dangerous - for now! | |
#aptitude purge cpp-4.3 gcc-4.3-base | |
#aptitude purge cpp-4.4 gcc-4.4-base g++-4.4 | |
#aptitude purge python2.6 python2.6-minimal | |
# Dangerous: selectively remove packages you don't think you need | |
#orphaner --purge | |
#debfoster | |
# Clear as many apt caches as we can | |
apt-get update -qq | |
apt-get clean | |
# Delete lots and lots of files | |
rm -rf /home/vagrant/.bash_history \ | |
/root/.bash_history \ | |
/usr/src/vboxguest* \ | |
/usr/share/doc \ | |
/var/lib/dhcp*/* | |
find /var/cache -type f -exec rm -rf {} \; | |
find /var/log -type f | while read f; do echo -ne '' > $f; done; | |
# Zero the free space - this first command WILL fire an error | |
dd if=/dev/zero of=/EMPTY bs=1M | |
rm -f /EMPTY | |
# Optional, if it's running: clear memcache | |
etc/init.d/memcache restart | |
exit # log out of sudo | |
exit # log out of the instance |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment