Skip to content

Instantly share code, notes, and snippets.

@shalomb
Last active April 21, 2023 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shalomb/064bbc5729fe9b4616d66dd70f4c0039 to your computer and use it in GitHub Desktop.
Save shalomb/064bbc5729fe9b4616d66dd70f4c0039 to your computer and use it in GitHub Desktop.
Minimal Debian Image
# Install cleanup utils
apt-get install -y deborphan
# Remove all desktop/gui/hci packages/libraries
apt-get purge -yyq --auto-remove \
task-desktop x11-common fdutils \
'*ubuntu-desktop*' \
'*X11*' '*wayland*' '*xdmcp*' '*gtk*' '*gnome*' 'x11-*' '*font*' \
'*orca*' '*bluez*' '*bluetooth*' '*audio*' '*desktop*' '*laptop*' \
'*acpi*' '*spell*' '*avahi*' '*-faq*' '*cups*' '*sane*' '*icon*' \
'*theme*' '*at-spi*' '*software-properties*' '*texlive*' '*xfonts*' \
'libx11*' 'libice*' 'libxcd*' 'libxdm*' 'libqtcore*' 'libkdecore*' 'kde*'
for meta in ubuntu-desktop task-desktop x11-common; do
apt-get purge -yyq --auto-remove $(apt-cache depends "$meta" | grep Depends | awk '{print $2}')
done
while deborphan | xargs dpkg -P ; do
sleep 0.1
echo Cleaning up orphaned files
done
# Cleanup packages
apt-get -y clean
apt-get -y autoclean
apt-get -y autoremove --purge
# Cleanup files
apt-get remove -y --purge $(dpkg -l | awk '/^rc/{print $2}')
rm -rf /usr/share/man/??
rm -rf /usr/share/man/??_*
# post-cleanup config
systemctl set-default multi-user.target
# post-install
apt-get install -yyq ca-certificates build-essential netbase sudo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment