Debian APT and DPKG details

Source: Internet
Author: User
Tags unpack
Debian APT and DPKG details-Linux Release Technology-Debian information. The following is a detailed description. I. Use of APT (Ubuntu Linux package management tool I)
Apt-cache search # ------ (package search package)
Apt-cache show # ------ (package obtains package information, such as description, size, and Version)
Sudo apt-get install # ------ (package installation package)
Sudo apt-get install # ----- (package--reinstall re-installation package)
Sudo apt-get-f install # ----- (Force installation? # "-F = -- fix-missing"
Install it ...)
Sudo apt-get remove # ----- (delete package)
Sudo apt-get remove--purge # ------ (package deletes a package, including deleting a configuration file
)
Sudo apt-get autoremove -- purge # ---- (package deletes packages and their dependent packages + configuration files (only valid for 6.10, it is strongly recommended ))
Sudo apt-get update # ------ update source
Sudo apt-get upgrade # ------ Update installed packages
Sudo apt-get dist-upgrade # --------- upgrade the system
Sudo apt-get dselect-upgrade # ------ upgrade with dselect
Apt-cache depends # ------- (package knows how to use dependencies)
Apt-cache rdepends # ------ (does package know a specific dependency? # Check which packages the package depends on ...)
Sudo apt-get build-dep # ------ (package installation related compilation environment)
Apt-get source # ------ (package downloads the source code of the package)
Sudo apt-get clean & sudo apt-get autoclean # -------- clear the downloaded file
Files & only clear outdated packages
Sudo apt-get check # ------- check for any corrupted Dependencies

Apt-get install usage
Apt-get install
Download Install or upgrade all dependent packages. if a package is set to hold (stop flag, it will be put aside (that is, it will not be upgraded ). for more information about hold, see the following.

Apt-get remove [-- purge]
Remove And any other packages dependent on the package. -- purge indicates that the package should be completely purged (purged). For more information, see dpkg-P.

Apt-get update
Upgrade the package list from the Debian image. If you want to install any software on the day, run the package at least once a day and modify the package every time.
/Etc/apt/sources. list must be executed.

Apt-get upgrade [-u]
Upgrade the package to the latest available version. old packages will not be installed or removed. if a package has changed its dependency and needs to be installed with a new package, it will not be upgraded, but will be marked as hold. apt-get update will not upgrade the package marked as "hold" (this is what "hold" means ). see how to manually set the package to hold. I suggest using the '-U' option at the same time, because you can see which packages will be upgraded.

Apt-get dist-upgrade [-u]
Similar to apt-get upgrade, apart from dist-upgrade, packages will be installed and removed to meet the dependency. Therefore, it is dangerous.

Apt-cache search
Search satisfied The package and description.

Apt-cache show
Display .

Apt-cache showpkg
Display Many details, as well as relationships with other packages.

Dselect, console-apt, aptitude, and gnome-apt are several graphical front ends of APT (some of which must be installed before use ). here, dselect is undoubtedly the most powerful, the oldest, and the most difficult to control.

Ii. Usage of DPKG (Ubuntu Linux package management tool 2)
Dpkg-I
Install a Debian package file, such as the file you downloaded manually.

Dpkg-c
List .

Dpkg-I
Slave To extract the package information.

Dpkg-r
Remove an installed package.

Dpkg-P
Completely clear an installed package. Unlike remove, remove only deletes data and is executable.
File. purge also deletes all preparation files.

Dpkg-L
List A list of all installed files. Check A. deb file by using dpkg-c.
.

Dpkg-s
Show the information of installed packages. Also, see apt-cache to display the package information in the Debian archive
And dpkg-I to display
The package information extracted from the. deb file.

Dpkg-reconfigure
Re-prepare an installed package, if it uses debconf (debconf for package installation
For a unified configuration interface). You can re-configure debconf itself, if you want to change its front-end
Or the priority of the question. For example, re-prepare debconf and use a dialog front-end for simple operation:

Dpkg-reconfigure -- frontend = dialog debconf
Change back

Echo" Hold "| dpkg -- set-selections
Set (Command line)

Dpkg -- get-selections" "
Retrieved (Command line)

Wildcard characters are supported, such:
Debian :~ # Dpkg -- get-selections * wine *

Note:

For example:
We are using gaim-0.58 + QQ-plugin, in order to prevent gaim from being upgraded, we can use
The method is as follows:

Method 1:
Debian :~ # Echo "gaim hold" | dpkg -- set-selections
Then run the following command to check:
Debian :~ # Dpkg -- get-selections "gaim"
Gaim hold
The Current Status indicates "hold" and cannot be upgraded.

What should I do if I want to restore it?
Debian :~ # Echo "gaim install" | dpkg -- set-selections
Debian :~ # Dpkg -- get-selections "gaim"
Gaim install
At this time, the status flag is reset to install again, and the upgrade can continue.

Comrades will ask, which of these status signs are written in which file?
In/var/lib/dpkg/status, you can also modify this file to implement hold.

Sometimes you may find that some software status indicators are purge.
For example, amsn has been installed in advance and is unloaded.
Apt-get remove -- purge amsn
Then the status flag changes from install to purge.

Method 2:
Manually create a preferences file under/etc/apt
Content:
Package: gaim
Pin: version 0.58 *
Save

Dpkg-S
Find in the package Database And tell you which package contains this file.
First Installed Package)

Build deb packages from source code

Apt-get source [-B]
Download a source code package and unlock it.
You must write a deb-src record in your/etc/apt/sources. list file to complete this operation.
Task.
If you enter a-B parameter and are root, the deb package is automatically created.

Apt-get build-dep
Automatically download and install the tool and create it through source code Required package.
Only apt 0.5 and later versions support this function.
Currently, woody and later versions include this function.
If you have an old version of apt, the easiest way to find dependencies is to view the source package
Debian/control file,
Note that the path is relative to the path in the package.

Common usage, combined with apt-get source-B, example (as root ):

Apt-get build-dep
Apt-get source-B

Will download the source code package, establish dependencies, and then try to compile the source code.

Dpkg-source-x
If you manually download the source code package of a program, it contains several classes
Like .orig.tar.gz,. dsc,
And files like .diff.gz,
Then you can use this command to unpack the source code package for the. dsc file.

Dpkg-buildpackage
Create a deb package from the Debian source code tree. It takes effect only in the source tree home directory. Example
For example:

Dpkg-buildpackage-rfakeroot-uc-B

Here '-rfakeroot' specifies the command to use the fakeroot program to mimic the root permission (to implement all
Ownership purpose ),
'-Uc' indicates "Don't cryptographically sign the changelog",'-B 'indicates that only
Binary Package.

Debuild
A Fast packaging script, similar to dpkg-buildpackage, can automatically identify whether to use fakeroot,
Run lintian and gpg

Modify dependency relationship

Dpkg -- configure -- pending
If dpkg fails to exit when apt-get install upgrade dist-uptradeing,
Use this command to configure unpack packages.
Use apt-get install, upgrade, or dist-upgrade-f,
Then use apt-get install, upgrade, or dist-upgrade.

It may be repeated multiple times, which usually solves most of the dependency problems.
(If you are prompted to require a specific package for some reason, you can install or uninstall the package with common sense)

Apt-get install-f
Apt-get upgrade-f
Apt-get dist-upgrade-f
Try to correct the dependency in the above process
Note that apt-get install-f is not required As a parameter.


Use apt-cdrom-d/media/cdrom0 add to load the optical drive,

/Dev/hdc/cdrom iso9660 user, noauto 0 0
Use the editor to modify the disk and restart it.
Then, apt-cdrom-d/cdrom add
Apt-get install (the software name you want to install: gcc for example)
Software related to gcc is automatically loaded.
Yesterday, I just tried it. It's amazing.
Note: apt does not recognize the optical drive you manually attached. If the fstab settings are incorrect, apt will not work normally.

Use apt-cdrom-d/media/cdrom0 add to load the optical drive,
You need to use # mkdir/media/cdrom0. Otherwise, an error will be prompted: "The file system cannot be read and mounted.
Click/media/cdrom status-stat (2 does not have that file or directory )"

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.