Issue
I have a script to compile several programs of a LEMP server (nginx, php, openssl, etc ...), I would like to know what packages I could delete after finishing with the compilations.
I leave the code fragments where I install and clean packages inside the script.
Package installation
# TODO: check this: Packages that can be deleted after the script is finished.
apt-get -y install libxau-dev libxdmcp-dev xorg-sgml-doctools \
libexpat1-dev xsltproc docbook-xsl \
docbook-xml needrestart autoconf \
automake m4 bison \
build-essential g++ pkg-config \
autotools-dev libtool expect \
libcunit1-dev x11proto-core-dev file \
libenchant-dev libjemalloc-dev gnu-standards \
autoconf-archive g++-multilib gcc-multilib \
libstdc++-6-dev gcc-6-locales \
g++-6-multilib valgrind valgrind-mpi \
valkyrie gcj-jdk flex \
tk-dev libc-ares-dev
# TODO: check this: Important packages that must be installed.
apt-get -y install coreutils binutils uuid-dev wget \
mcrypt libmcrypt-dev cython \
perl libpcre3 libpcre3-dev \
libxml2-dev libxslt1-dev \
libfreetype6-dev libfontconfig1-dev \
libtiffxx5 libjpeg62-turbo-dev libjpeg-dev libpng-dev \
libbz2-dev zlib1g-dev libzip-dev \
libjansson-dev \
libgmp-dev libev-dev libevent-dev \
libsqlite3-dev libgdbm-dev libdb-dev \
libsystemd-dev libspdylay-dev \
libaio-dev libncurses5-dev \
libunistring-dev libunbound-dev \
trousers libidn2-0 \
libicu-dev libltdl-dev libpspell-dev libreadline-dev \
libc6-dev libc-dbg libpam0g-dev libmsgpack-dev libstemmer-dev libbsd-dev \
gettext debian-keyring liblinear-tools liblinear-dev \
libdbi-perl libboost-all-dev rsync net-tools libdbd-mysql-perl \
re2c libboost-dev libboost-thread-dev qt4-qmake libqt4-dev \
libssl-dev golang python-dev python3-dev python-setuptools
Package cleaning
apt-get -y remove libxau-dev libxdmcp-dev xorg-sgml-doctools \
libexpat1-dev xsltproc docbook-xsl \
docbook-xml needrestart autoconf \
automake m4 bison \
build-essential g++ pkg-config \
autotools-dev libtool expect \
libcunit1-dev x11proto-core-dev file \
libenchant-dev libjemalloc-dev gnu-standards \
autoconf-archive g++-multilib gcc-multilib \
libstdc++-6-dev gcc-6-locales \
g++-6-multilib valgrind valgrind-mpi \
valkyrie gcj-jdk flex \
tk-dev libc-ares-dev
apt-get -y autoremove apt-get clean
I guess it's a good practice to do this kind of cleaning, I could clean all the packages that their names end in -dev. Or could this affect something?
Thank you.
Solution
This all depends.
If you are creating one or several Debian packages by your compiling
, using proper packaging tools and workflows), and afterwards install them (via dpkg
), these packages will contain dependency information (some automatically detected - like which dynamic libraries are required to run/load the generated binaries; others manually added during the packaging process).
These dependencies will then ensure that all the required packages will stay installed.
However, if you just compile some random software superserver
and install it via make install
, the system has no way of knowing that your binary /usr/local/bin/superserver
actually requires the presence of Debian packages.
When you installed some -dev
packages to satisfy build dependencies, this might have pulled in some additional packages (typically the corresponding dynamic libraries; e.g. installing libfoo-dev
will make sure that you also have libfoo0
installed).
Once you have removed all packages (e.g. libfoo-dev
) that depend on another package which has been automatically installed to satisfy these dependencies (e.g. libfoo0
), then apt-get -y autoremove
will automatically remove those leftovers.
So if your superserver
depends on libfoo0
but the system doesn't know about it, you will end up with a broken superserver
binary.
Answered By - umläute