I often need a Linux virtual machine for testing specific things. Debian Linux is my choice of Linux distribution, and I have wondered how much space does each installed package take in it, to possibly optimize the size of the VM if needed.
I installed two VMs:
- “Normal” install: using the latest Debian 12.10 netinstall CD, text install, language English, country Finland, keyboard Finnish; unselected the preselected “Debian desktop environment” and “GNOME”, selected “SSH server” and “standard system utilities”
- “Smaller” install: the same but without “standard system utilities”.
The results after “sudo apt clean
“:
Installation | Disk usage (df -h ) | Packages (dpkg -l ) |
---|---|---|
Normal install | 1.2 GB | 330 |
Smaller install | 1.1 GB | 246 |
Definitely not a huge difference in the size. For the reference, I have the list of packages missing from the smaller installation in the end of the post.
I should note that these were the base installs, some other packages may be installed later on top of those, depending on the case at hand.
On the normal install I also ran a script to calculate the total size of the files per package. Here are the 20 largest packages:
Package | Size |
---|---|
linux-image-6.1.0-32-amd64 libicu72:amd64 libperl5.36:amd64 iso-codes coreutils grub-common perl-modules-5.36 intel-microcode locales libc6:amd64 perl-base udev libglib2.0-data systemd libpython3.11-stdlib:amd64 libmagic-mgc util-linux-locales bash python3.11-minimal xkb-data | 386.89 MB 35.30 MB 27.79 MB 18.52 MB 17.34 MB 17.18 MB 16.63 MB 15.61 MB 15.11 MB 12.20 MB 10.69 MB 10.43 MB 8.93 MB 8.80 MB 7.92 MB 7.92 MB 7.71 MB 6.86 MB 6.59 MB 6.45 MB |
Quite unsurprisingly, the kernel package (with all the drivers it contains) is the largest one. But otherwise, there isn’t much to gain by removing single packages from the system. Yes, if you want absolute small size, use purpose-built containers, not virtual machines.
Finally, the list of packages that were not installed if “standard system utilities” option was unchecked:
apt-listchanges
bash-completion
bind9-dnsutils
bind9-host
bind9-libs:amd64
bsdextrautils
bzip2
ca-certificates
debian-faq
distro-info-data
doc-debian
file
groff-base
inetutils-telnet
iso-codes
krb5-locales
libcurl3-gnutls:amd64
libfstrm0:amd64
libgdbm-compat4:amd64
libgdbm6:amd64
libjemalloc2:amd64
libldap-2.5-0:amd64
libldap-common
liblmdb0:amd64
liblockfile-bin
libmagic-mgc
libmagic1:amd64
libmaxminddb0:amd64
libnghttp2-14:amd64
libnss-systemd:amd64
libperl5.36:amd64
libpipeline1:amd64
libprotobuf-c1:amd64
libpsl5:amd64
libpython3-stdlib:amd64
libpython3.11-minimal:amd64
libpython3.11-stdlib:amd64
librtmp1:amd64
libsasl2-2:amd64
libsasl2-modules:amd64
libsasl2-modules-db:amd64
libsqlite3-0:amd64
libssh2-1:amd64
libuchardet0:amd64
libuv1:amd64
lsb-release
lsof
mailcap
man-db
manpages
media-types
mime-support
netcat-traditional
openssl
perl
perl-modules-5.36
publicsuffix
python-apt-common
python3
python3-apt
python3-certifi
python3-chardet
python3-charset-normalizer
python3-debconf
python3-debian
python3-debianbts
python3-httplib2
python3-idna
python3-minimal
python3-pkg-resources
python3-pycurl
python3-pyparsing
python3-pysimplesoap
python3-reportbug
python3-requests
python3-six
python3-urllib3
python3.11
python3.11-minimal
reportbug
systemd-timesyncd
traceroute
wget
xz-utils