Ubuntu – How to install recommend packages from a file (package.deb)

aptdpkggdebipackage-management

I have a package.deb and want to install all dependencies (Depends field in debian/control) and all recommend packages (Recommends field in debian/control).

Options considered so far:

  • Gdebi apparently does not support installing recommend packages.
  • "sudo dpkg -i package.deb" followed by "sudo apt-get install –install-recommends -f" also only installs dependencies (Depends field in debian/control), but not recommend packages (Recommends field in debian/control).

Any other ideas?

Best Answer

One solution would be to set up your personal APT repository and install the package with APT from there.

Another possibility is to extract the dependencies from the package description. This script pulls the Recommends: line from the description in the .deb file and removes versions and keeps only the first alternative when there are several.

apt-get install $(dpkg-deb -I foo.deb |
                  sed -n 's/^ *\(Depends\|Recommends\)://p' |
                  tr , $'\n' |
                  sed 's/[|(].*//')

With aptitude, you can install the set of packages matched by a pattern. If there are alternatives, install the one you want first.

aptitude install '?reverse-recommends(foo)'

From the aptitude full-screen interface, highlight the package, press Enter, navigate to “Recommends” and press + then g.