In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to view the dependencies of a software package in a Linux distribution based on Ubuntu or Debian. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
What is package dependency in Ubuntu?
When you install a package in Linux, sometimes the package needs other packages to make it work. These additional packages are called dependencies for this package. If these packages are not previously installed on the system, these dependencies will be installed automatically when the package is installed.
For example, HandBrake, a GUI tool used to convert video formats, requires FFmpeg and GStreamer packages. So for HandBrake, FFmpeg and GStreamer are its package dependencies.
If these packages are not installed on your system, they will be installed automatically when you install HandBrake on Ubuntu.
View the dependencies of a software package in Ubuntu and Debian-based distributions
As often happens on Linux, there are several ways to achieve the same goal. Let's take a look at several ways to see the dependencies of a package.
Use apt show to view dependencies
You can use the apt show command to display the details of a package. Dependency information is part of it, and you can see it in the lines that start with "Depends".
For example, the following shows the details of showing the package ubuntu-restricted-extras using apt show:
Abhishek@itsfoss:~$ apt show ubuntu-restricted-extras Package: ubuntu-restricted-extrasVersion: 67Priority: optionalSection: multiverse/metapackagesOrigin: UbuntuMaintainer: Ubuntu Developers Bugs: https://bugs.launchpad.net/ubuntu/+filebugInstalled-Size: 14.3 kBDepends: ubuntu-restricted-addonsRecommends: libavcodec-extra, ttf-mscorefonts-installer UnrarDownload-Size: 3200 BAPT-Manual-Installed: yesAPT-Sources: http://us.archive.ubuntu.com/ubuntu focal/multiverse amd64 PackagesDescription: Commonly used media codecs and fonts for Ubuntu This collection of packages includes:-MP3 and other audio codec software to play various audio formats (GStreamer plugins)-software to install the Microsoft Web fonts-the Adobe Flash plugin-LAME, software to create compressed audio files. . This software does not include libdvdcss2, and will not let you play encrypted DVDs. For more information, see https://help.ubuntu.com/community/RestrictedFormats/PlayingDVDs. These software packages are from the Multiverse channel, restricted by copyright or legal issues in some countries. For more information, see http://www.ubuntu.com/ubuntu/licensing
As you can see, the ubuntu-restricted-extras package depends on the ubuntu-restricted-addons package.
But you have to be careful that depending on packages may also depend on other packages, so that the cycle goes on and on until the end. But fortunately, the APT package manager can handle these complex dependencies for you, automatically installing all the dependencies (in most cases).
What is a recommendation bag?
Have you noticed the lines that start with "Recommends" in the output above?
Recommendation packages are not directly dependent on the package, but they can turn on some additional features of the package.
As you can see above, the ubuntu-restricted-extras package has the ttf-mscorefonts-installer recommendation package for installing Microsoft fonts on Ubuntu.
These recommendation packages are also installed by default, and if you want to explicitly disable the installation of these recommendation packages, you can use the-no-install-recommends option as below.
Sudo apt install--no-install-recommends package_name uses apt-cache to get dependency information directly
The above apt show will get a lot of information, if you want to get dependency information in the script, then the apt-cache command will give you a better and more concise output.
Apt-cache depends package_name
The following output looks cleaner, doesn't it?
Use dpkg to view the dependencies of a DEB file
Both apt and apt-cache work on packages in the software repository, but if you download a DEB file, these two commands will not work.
In this case, you can use the-I or-- info options of the dpkg command.
Dpkg-I path_to_deb_file
Dependency information can be found in lines that start with "Depends".
Use apt-rdepends to view dependencies and dependent dependencies
If you want to see more information about dependencies, you can use the apt-rdepends tool. This tool creates a complete dependency tree. In this way you can get a package of dependencies and those dependencies.
It is not a regular apt command, so you need to install it from the universe software repository:
Sudo apt install apt-rdepends
The output of this command is usually large, depending on the size of the dependency tree.
Reading package lists... DoneBuilding dependency treeReading state information... Doneshutter Depends: procps Depends: xdg-utilsimagemagick Depends: imagemagick-6.q16 imagemagick-6.q16 Depends: hicolor-icon-theme Depends: libc6 (> = 2.4) Depends: libmagickcore-6.q16-6) Depends: libmagickwand-6.q16-6 (> = 8purl 6.9.10.2) hicolor-icon-themelibc6 Depends: libcrypt1 (> = 1purl 4.4.10-10ubuntu4) Depends: libgcc-s1libcrypt1 Depends: libc6 (> = 2.25)
The apt-rdepends tool is very versatile, and it can also be used to calculate reverse dependencies. This means that you can see which packages a particular package is dependent on.
Apt-rdepends-r package_name
The output may be very large because it will print out the reverse dependency tree.
Abhishek@itsfoss:~$ apt-rdepends-r ffmpegReading package lists... DoneBuilding dependency tree Reading state information... Doneffmpeg Reverse Depends: ardour-video-timeline (> = 1Reverse Depends 5.12.0-3ubuntu4) Reverse Depends: deepin-screen-recorder (5.0.0-1build2) Reverse Depends: devede (4.15.0-2) Reverse Depends: dvd-slideshow (0.8.6.1-1) Reverse Depends: green-recorder (> = 3.2.3) this is the end of the article on "how to view a package dependency in a Ubuntu or Debian-based Linux distribution" Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 295
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.