Apt-get and Aptitude and dpkg

Source: Internet
Author: User
1. Overview

Apt-get and aptitude are all tools for installing software upgrades under Debian.

But aptitude is better at dealing with dependency issues. Aptitude deletes a package that is useless and that is dependent on itself. In this way, the system will not remain useless packets, the whole system cleaner.

Therefore, it is more recommended to use the Aptitude command.



2. Sources.list Software Data source

$ sudo vi/etc/apt/sources.list

Configure the software data source. Generally used in domestic, such as 163 of data sources:
Http://mirrors.163.com

A description of the form 163 is also provided, as follows:
Http://mirrors.163.com/.help/debian.html


3. Apt-get and Aptitude Command detailed (take VSFTPD as an example, both commands are listed, contrast)

(1) After configuring the Source.list, upgrade the software update list first

$ sudo apt-get update

$ sudo aptitude update


(2) Upgrade installed packages

$ sudo apt-get upgrade

$ sudo aptitude upgrade


(3) Upgrade the system to the appropriate distribution (according to the source.list configuration)

$ sudo apt-get dist-upgrade

$ sudo aptitude dist-upgrade


If you want all installation prompts to answer yes directly by default, the following are:

$ sudo apt-get dist-upgrade--force-yes-y

$ sudo aptitude dist-upgrade-y


(4) Search Packages

$ Apt-cache Search VSFTPD

$ aptitude Search VSFTPD

Note: The search package does not require root permissions.


(5) View Package Introduction

$ Apt-cache Show vsftpd

$ aptitude Show VSFTPD

Note: View package introduction does not require root permissions. Review the package description, whether it is installed, and so on.


(6) installation package

$ sudo apt-get install vsftpd

$ sudo aptitude install VSFTPD


(7) Delete Package

$ sudo apt-get remove vsftpd

$ sudo aptitude Remove vsftpd


Only remove, still retains the software configuration file. If you want all of the related software's configuration files to be deleted, use the following command:

$ sudo apt-get purge vsftpd

$ sudo aptitude purge vsftpd


When using Apt-get, you want to delete the dependent packages as well, then use Autoremove:

$ sudo apt-get autoremove vsftpd

On the Autoremove, Apt-get's Man handbook says:
Autoremove is used to remove packages that were automatically
Installed to satisfy dependencies for some package and that are no
More needed.


(8) Cleaning system

$ sudo apt-get clean
$ sudo apt-get AutoClean

$ sudo aptitude clean
$ sudo aptitude AutoClean

Note: Clean => Delete the downloaded package file; AutoClean => only delete expired package files


4. View installed packages via dpkg

(1) View all installed package information of the system

$ dpkg-l


(2) View all files belonging to a package (such as: VSFTPD)

$ dpkg-l VSFTPD

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.