Monday, April 29, 2024
29
rated 0 times [  29] [ 0]  / answers: 1 / hits: 52267  / 1 Year ago, wed, may 17, 2023, 3:13:48

Running sudo apt-get install <PACKAGE> will install the package, its dependencies, and any other recommended packages.



However, there does not seem to be a way to install only the dependencies of a package and exclude the package itself.



How would one go about doing this?


More From » package-management

 Answers
2

This will install all packages in the package's Depends and PreDepends field:



sudo apt-get install $(apt-cache depends <PACKAGE> | grep Depends | sed "s/.*ends: //" | tr '
' ' ')


Basically you ask for all dependencies, filter out the (Pre)Depends, and format that output for apt-get.



One problem are dependencies like



Depends: pulseaudio
pulseaudio:i386


or virtual packages like



Depends: <java6-runtime-headless>
default-jre-headless
openjdk-6-jre-headless


So: use with care - it doesn't work in all cases!


[#42380] Thursday, May 18, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
enincroscope

Total Points: 252
Total Questions: 124
Total Answers: 104

Location: Tajikistan
Member since Thu, Apr 14, 2022
2 Years ago
;