Apt is more than apt-get.

Source: Internet
Author: User
Apt is more than apt-get -- Debian information of the Linux release version. For more information, see below. In ubuntu (debian), installing software with apt-get or synaptic is very easy. In addition to simple installation software, apt tool set has many usage in special cases.

Remember that the man manual is a mentor at any time.

1. Use aptitude instead of apt-get.
Although aptitude does not have the "Super Awesome" function of apt-get, it is more powerful than apt-get.
First, you can install software like apt-get.

Aptitude install pack-foo

Aptitude is more intelligent in solving dependencies than apt-get. sometimes, when you use apt-get to install software, errors such as "XXX requires XXXX, But XXX has been installed" may occur. this is usually because some software packages are too new. when aptitude is used, aptitude will discover the problem and provide several solutions. We only need to accept the solution that fits our minds.

Another advantage of aptitude is that it will automatically record the packages that are "automatically installed" (that is, those installed due to dependency). If the packages that depend on the "automatically installed" package are not installed, the "automatic installation" Package (useless at this time) will be automatically deleted.
You can use these two commands to control the "Automatic Installation" attribute of the package.

Aptitude markauto pack-foo # mark as "automatic installation"
Aptitude unmarkauto pack-foo # mark as "manual installation"

When you delete software, use markauto instead of remove to avoid accidental deletion of important packages.
Of course, the new version and apt-get have similar functions, but it does not seem to use the same database as aptitude. Therefore, we recommend that you only use the aptitude management package.

Aptitude also provides a more flexible way to control the software package version.

Hold-keep the Software Package
Unhold-cancel the hold command for a software package
Forbid-version-Disable aptitude from being upgraded to a specific version of the software package.

The libcairo event of the previous weeks is used as an example:
Sudo aptitude install libcairo2 = 1.4.10-1ubuntu4 # force downgrade
Sudo aptitude forbid-version libcairo2 = 1.4.10-1ubuntu4. 1 # disable the version with an error
Sudo aptitude markauto libcairo2 # restore the auto attribute

See the description of the install operation in the man manual for more control methods.

Aptitude reinstall the software package, which is equivalent to apt-get? Reinstall install
Aptitude purge completely deletes the software package, which is equivalent to apt-get? Purge remove
Tips
Aptitude purge 'dpkg-l | grep' ^ rc '| awk' {print $2 }''

Aptitude also integrates the functions of multiple apt tools

Search-search for software packages by name and/or expression
Show-displays the details of a software package.
Download-download the. deb file of the software package

The search operation is special.

Aptitude search "foo bar" # Keys foo and bar must appear
Aptitude search foo bar # equivalent to "or"

However, aptitude has a small disadvantage. By default, the "recommended" package will be treated as a "dependent" package. In this way, you can solve the problem by setting it.
Add a sentence to the. aptitude/config file in the home directory of the user and the root user.

Aptitude: Recommends-Important "false ";

For more detailed usage, see man aptitude.
In addition:
1. The interaction mode of aptitude seems to be messy. It is better to use the new mode.
2. Use aptitude install-f with caution.

2. Obtain
Simple

Use a new version:
1. Select the package to be installed
2. File-> Generate the package download script

Use apt-get
Apt-get? Print-uris install pack-foo

3. Install the required package
First, make sure you have added the deb-src Source, just like this
Deb-src http://ubuntu.cn99.com/ubuntu/ gutsy main restricted universe multiverse

And has apt-get update
Then you can
Apt-get build-dep pack-foo

Install the package required for compiling pack-foo

PS: the more powerful method is to use apt-build. However, ubuntu is too much like gentoo. If you are interested, you can check the man of apt-build on your own.

4. Find the package in which a file is located.
If the package is installed, you can use dpkg-S, but this method does not work for uninstalled packages.
Now you can use apt-file

$ Apt-file help
Apt-file version 2.0.8.2
(C) 2002 Sebastien J. Gross

Apt-file [options] action [pattern]

Configuration options:
? Sources-list-s sources. list location
? Cache-c

Cache directory
? Architecture-a Use specific architecture
? Cdrom-mount-d Use specific cdrom mountpoint
? Package-only-l Only display packages name
? Fixed-string-F Do not expand pattern
? Ignore-case-I Ignore case distinctions
? Regexp-x pattern is a regular expression
? Verbose-v run in verbose mode
? Dummy-y run in dummy mode (no action)
? Help-h Show this help.
? Version-V Show version numberAction:
Update Fetch Contents files from apt-sources.
Search | find
Search files in packages
List | show
List files in packages
Purge Remove cache files

This tool is useful when looking for files missing during compilation. Remember to use apt-file update before using it.

PS: auto-apt has the same function and can detect the missing files required by the process. It automatically prompts the user to choose to install the corresponding package.

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.