minimize file size of appliances
Posted: 20. Feb 2011, 08:05
I'd like to compile a list of good TODOs for cleaning up a Linux guest before exporting as an appliance.
currently I do:
1. Clean out all of the cloned repos.
This may seem odd, but the fact is whenever someone uses this appliance the open source projects are going to be out of date so an update would be needed. Why transmit outdated code? I do this with:
2. Clean up the package manager (Debian/Ubuntu)
sudo localepurge
sudo apt-get purge
sudo apt-get autoremove
I'd love to hear more suggestions. I've used du to find the heavy directories but do not feel comfortable removing things in these dirs:
currently I do:
1. Clean out all of the cloned repos.
This may seem odd, but the fact is whenever someone uses this appliance the open source projects are going to be out of date so an update would be needed. Why transmit outdated code? I do this with:
Code: Select all
# from my src dir where all the code lives
cur=$PWD;
for g in $(find . -type d -name .git | sort | sed 's/.\{5\}$//');
do
echo $g;
(cd $g; [[ $PWD != $cur ]] && rm -rf * .git/refs/*/* .git/objects/* .git/branches/*)
done
sudo localepurge
sudo apt-get purge
sudo apt-get autoremove
I'd love to hear more suggestions. I've used du to find the heavy directories but do not feel comfortable removing things in these dirs:
Code: Select all
131M /lib
42M /usr/bin
24M /usr/include
363M /usr/lib
72M /usr/local
4.9M /usr/sbin
272M /usr/share
81M /usr/src
3.4M /var/backups
36M /var/cache
123M /var/lib