Apt and dpkg command usage for Management Packs in Linux

Source: Internet
Author: User
Tags pack

1,apt-get command

Apt-get is a Debian,ubuntu release package management tool, very similar to the Yum tool in Red Hat, for the Deb package managed operating system, which is used to automatically search, install, upgrade, uninstall software or operating systems from the Internet's software warehouse. Apt-get When installing the package is based on the source specified in the/etc/apt/sources.list file to find the installation package, you can according to your needs to modify this file.

Details are as follows:

    • sudo apt-get install package
    • sudo apt-get Install package--Reinstall reinstall packages
    • sudo apt-get-f install fix "-F =--fix-missing"
    • sudo apt-get Remove Package
    • sudo apt-get Remove Package--purge delete packages, including deletion of configuration files, etc.
    • sudo apt-get autoremove package deletes packages and their dependent packages
    • sudo apt-get update source
    • sudo apt-get upgrade update installed packages
    • sudo apt-get Dist-upgrade upgrade system
    • sudo apt-get dselect-upgrade using Dselect upgrade
    • sudo apt-get BUILD-DEP Package Installation-related compilation environment
    • sudo apt-get source package downloads The source code for the bundle
    • sudo apt-get clean && sudo apt-get autoclean cleanup of useless packages
    • sudo apt-get check to see if there is a corrupted dependency

Chart version:

apt-getSome of the tools that are commonly used include:

Tools Description
install followed by a package name for installing a package
update Download/update the list of packages used to update the local software source from the software source mirror server
upgrade Upgrade all locally updatable packages, but will not be upgraded if there is a dependency problem, and will usually be executed once before the updateupdate
dist-upgrade Resolve Dependencies and upgrade (there is a risk)
remove Remove installed packages, including packages that are dependent on the removed package, but do not contain a configuration file for the package
autoremove Remove packages that were previously dependent on other packages but are no longer being used
purge Same as remove, but completely removes the package, including its configuration file
clean Remove the installed packages that are downloaded to the local, which are saved by default in/var/cache/apt/archives/
autoclean Remove older versions of software that have already been installed

Apt-get Common parameters:

Parameters Description
-y It is useful to use this parameter in some automated installation scripts to automatically respond to the option to install packages.
-s Analog installation
-q Silent installation, specifying multiple q or -q=# , #表示数字, to set the level of silence, which is useful when you do not want to have too much screen output when you install a package
-f Repairing a corrupted dependency
-d Download-Only not installed
--reinstall Reinstall installed packages that may have problems
--install-suggests Install the recommended package installed by apt at the same time
2,apt-cache command:

Apt-cache is primarily used to search for packages.

    • sudo Apt-cache search Package
    • sudo apt-cache Show package get information about packages, such as description, size, version, etc.
    • The sudo apt-cache showpkg Pack displays package information, including package dependencies, package providers,
    • sudo apt-cache pkgnames The name of all packages in the print package list
    • sudo apt-cache dumpavail For information about all packages in the Print packages list
    • sudo Apt-cache depends package learn about using dependencies
    • sudo apt-cache rdepends package is to see which packages are dependent on the package
3,dpkg command

Dpkg is a background package manager for the Debian system, similar to RPM. It is also a mainstay of the Debian package management system, which is responsible for securely uninstalling packages, configuring them, and maintaining installed packages. Because Ubuntu and Debian are same strain, many commands are equals.

All packages information in Ubuntu is in the/var/lib/dpkg/directory, where the subdirectory "/var/lib/dpkg/info" is used to save a list of profiles for each package. Different suffix names represent different types of files, such as:

The. Conffiles records the list of configuration files for the package.

The list of files in the package is saved, and the user can find the specific installation location of the files in the package from the. List information.

The. Md5sums records the package's MD5 information, which is used for packet validation.

The. Prerm script runs before the Debian packet is unpacked, and the main function is to stop the service that acts on the package that will be upgraded until the package installation or upgrade is complete.

The. Postinst script is a configuration that completes after the Debian package is unpacked and is typically used to perform commands and service restarts for the installed packages.

The content of the/var/lib/dpkg/available file is a description of the package, which includes all packages in the Debian installation source used by the current system, including installed and not installed packages on the current system.

Command details:

    • Dpkg–l | The grep package queries the details of the Deb Pack, and no packages are specified to show all installed packages
    • Dpkg-s Package View detailed information about the specified packages that have been installed
    • Dpkg-l Package List of all files installed
    • Dpkg-s file to see which package is part of the system and search for installed packages
    • Dpkg-i installing the specified Deb package
    • Dpkg-r followed by a directory name for installing all of the Deb installation packages in this directory
    • Remove an installed package from the Dpkg-r remove
    • Dpkg-p thorough uninstallation, including configuration files for the software
    • Dpkg-c querying the files contained in the Deb package file
    • Dpkg-l View a detailed list of installed packages in the system, and execute the-C

Apt and dpkg command usage for Management Packs in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.