Is there a better way to install only the required dependencies of a package, instead of installing it directly with apt-get (or any other frontend of dpkg) and then immediately removing it, leaving out its dependencies?
Is there a better way to install only the required dependencies of a package, instead of installing it directly with apt-get (or any other frontend of dpkg) and then immediately removing it, leaving out its dependencies?
apt-cache depends pkgname
will show a package's dependencies.If you want it all in one command, you could do worse than:
apt-get provides a command for exactly that...
From the man pages you get
aptitude will let you specify a query instead of a package name when installing. If you wanted to install the dependencies of package named
foo
, you can install the packages which have a reverse dependency onfoo
:or
The problem with installing a package then removing it, is that all of the packages which get installed as dependencies will be marked as "automatically installed", and would be removed by any install/remove/upgrade action by aptitude or when you run
apt-get autoclean
unless you mark them as manually installed usingaptitude mark
or theapt-mark
command.However, this begs the question of why you would want to do this my best guess is that you are trying to install dependencies for some software which you are going to compile by hand. In that case, you would install the build dependencies first with
apt-get build-dep packagename
, but then you should be creating a dummy package which has the runtime dependencies (which generally differ from the build dependencies) by using theequiv
package to build a dummy package with the correct dependencies for your manually compiled program. See information aboutequivs
in The APT HOWTOIn case of building pkgname from sources