How Ubuntu Apt-get Works

Source: Internet
Author: User
Tags sha1

http://kurenai.elastos.org/2013/05/02/ubuntu-apt-get%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86/

Let's start with a few directories related to Apt-get:

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

/var/cache/apt/archives
Directory is the temporary storage path of the package when installing software with Apt-get install

/etc/apt/sources.list
Storage is the software source site, when you execute sudo apt-get install XXX, Ubuntu will go to these sites to download packages to the local and perform the installation

/var/lib/apt/lists
Use the apt-get Update command to download the list of software from the/etc/apt/sources.list and save it to that directory

How APT works:

Ubuntu uses a centralized software warehouse mechanism that organizes and manages a wide variety of software packages in a repository. The software warehouse is then placed in a large number of mirror servers and remains basically consistent. This allows all Ubuntu users to get the latest version of the installation package at any time. Therefore, for users, these mirror servers are their source of software (reposity).

However, because each user is in a different network environment, it is not possible to access each mirror site at will. To be able to selectively access, in the Ubuntu system, use the software source profile/etc/apt/sources.list to list the most appropriate mirror site addresses to access.

Update process for Apt-get:
Perform apt-get update
Program Analysis/etc/apt/sources.list
Automatic network to find the corresponding Packages/sources/release list file in the list, if there are updates downloaded, into the/var/lib/apt/lists/directory
Then apt-get install the appropriate package, download and install it.

Even so, the software source profile simply tells the address of the mirror site that the Ubuntu system can access, but it is unclear what software resources are specifically owned by those mirror sites. If you install a software package, it is very inefficient to look for it on the server. Thus, it is necessary to make a list of these software resources (indexing files) for the local host to query.

Apt-get install downloaded software is stored under/var/cache/apt/archives/.

At the same time, APT is able to check package dependencies on Ubuntu Linux systems, greatly simplifying the process of installing and uninstalling software packages for Ubuntu users.

Apt-get Install principle:
Deb Http://cn.archive.ubuntu.com/ubuntu/precise main restricted

Can be found through the browser

Apt-get reads this file every time, thereby obtaining information about the package. Gets information about all packages from the packages.gz. The information contained in the PACKAGES.GZ is:

Package name, priority, type, maintainer, schema, source file, version number, dependency package, conflicting information, package size, File download path, MD5SUM,SHA1, package description, xul-appid-application id,bugs information, origin, Supported

Example of a package information in packages:

Package:abrowser
Priority:optional
Section:web
installed-size:153
Maintainer:ubuntu Mozilla Team <[email protected]>
Architecture:amd64
Source:firefox
Version:11.0+build1-0ubuntu4
Depends:firefox (>= 9.0)
Filename:pool/main/f/firefox/abrowser_11.0+build1-0ubuntu4_amd64.deb
size:8940
Md5sum:e8781af38a6de76126d190fc10a14bf2
sha1:408abd5f960d4b02bc18581df348954eb7620772
sha256:cdfad0e4435c035b3115bdec08d79ccfc68bf9480e89df9270b3b6befa348699
Description:safe and easy Web browser from mozilla–transitional package
description-md5:e89058e4775caff7d26313fa8811675e
Bugs:https://bugs.launchpad.net/ubuntu/+filebug
Origin:ubuntu
supported:18m

As you can see from this information section, the actual Deb package is placed in the pool/main/f/firefox/abrowser_11.0+build1-0ubuntu4_amd64.deb and can be found through the browser. You can also see the dependency requirements in depends.

How Ubuntu Apt-get Works

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.