Apt HOWTO-Chapter 2 Basics

xiaoxiao2021-03-06  78

Apt HowTo

Chapter 2 Basics

2.1 /etc/apt/sources.list file

==============================

As part of the operation, the APT uses a file to list the image site address of the available packages, this file is /etc/apt/sources.list.

The information in the file is usually listed in the format:

DEB

http://site.http.org/debian distribution section1 section2 section3

DEB-SRC

http://site.http.org/debian distribution section1 section2 section3

Of course, the address items listed above are unavailable. The first word DEB or DEB-SRC of each row describes the file type, which contains binary packages (DEB), which is the compiled package we usually use; or contain source package (DEB) -src), source package contains source program encoding, debian management file (.dsc), and "Debian" record file Diff.gz.

It usually shows the following Debian default Sources.list:

# See Sources.list (5) for more information, especial

# Remember That You Can Only Use HTTP, FTP OR File Uris

# CDROMS Are Managed Through The Apt-CDROM TOOL.

DEB

http://http.us.debian.org/debian Stable Main Contrib Non-Free

DEB

Http://non-us.debian.org/debian-non-us stable / non-us main control non-free

DEB

http://security.debian.org stable / updates main control Non-free

# Uncomment if you want the apt-get source function to work

# deb-src

http://http.us.debian.org/debian Stable Main Contrib Non-Free

# deb-src

http://non-us.debian.org/debian-non-us stable non-us

These are the Source address required for the DEBIAN basic installation, the first DEB line points to the official official package source, the second DEB line points to the Non-US software package source, the third DEB line points to the DEBIAN security patch update package source.

The last two lines were annotated (in the sentence first plus #), so the APT-GET will ignore them. These are the DEB-SRC line points to the Debian source package source, if you often download the program source code to test or recompile, you can cancel the comments to them.

The /etc/apt/sources.list file can contain multiple types of addresses, APT knows how to handle these different address types: HTTP, FTP, File (local files, for example: a directory loaded with ISO9600 file system) and SSH.

Don't forget to run the APT-GET after modifying the /etc/apt/sources.list file to make changes. You have to complete this step in order to get the APT to get a new list of packages from your designated place. 2.2 How to use APT locally

=====================

Sometimes there are many packages on your hard drive, you will want to install them through the APT to make it handle complex dependencies between the software.

If you want to do this, build a directory and put all the .deb files you want to install in. E.g:

MKDIR / ROOT / DEBS

You can use an override file directly to modify the definitions in the managed file in the package, so that you meet your software storage management rules, you may want to define some options in this overloaded file. To override the definitions of those packages, as shown below:

Package Priority Section

Package is the name of the package, Priority has three levels of Low, Medium, or High, Section is the section to which the package belongs, the overload file can be ordered, and the file name will be passed as a parameter to DPKG-Scanpackages in the next step. If you don't want to write overload files, just use / dev / null when calling DPKG-ScanPackages.

Still executing in / root directory:

DPKG-Scanpackages Debs File | Gzip> Debs / Packages.gz

In the above command line, the file is an overloaded file, the command generates a packages.gz file, which contains the various package information required for the APT, and uses these packages, plus: plus:

Deb file: / root debs /

To complete the above work, you can use the APT command to operate these packages. You can use the same way to generate a source code base, but remember that you need to include .orig.Tar.gz files, .dsc files, and .diff.gz files in the directory, generate a source.gz file instead of packages. GZ file. The command used is also different. To use dpkg-scansources, the command is as follows:

DPKG-Scansources Debs | Gzip> Debs / Sources.gz

Note DPKG-ScanSource does not require overload files, the reference to Sources.List is:

DEB-SRC File: / Root Debs /

2.3 Select the best mirror publishing site to join the Source.list file: NetSelect, NetSelect-Apt

============================================================================================================================================================================================================= ===================

A new user often asks questions: "Which debian mirror release site will join a source.list file?". There are many ways to choose the mirror release site, experts may write a script to test the ping time of different sites, but there is a ready-made program to help you: NetSelect.

Install NetSelect

Apt-Get Install NetSelect

It will display its help when running it without parameters. When running it, add a mirror host list with space separation, which will return a host name in a score and a list. This score is derived by evaluating ping time and hops number (a number of forwarding hosts through the forwarding host through the target host), which is expected to be counter-specific than the mirror site (the smaller the value). The returned host name is the lowest score in the list (see the list of the host score). See the example:

Bash $ netselect ftp.debian.org http.us.debian.org ftp.at.debian.org download.Unesp.br ftp.debian.org.br

365 ftp.debian.org.br

Bash $

It indicates that in all hosts listed after NetSelect, ftp.debian.org.br is the fastest hosting host, which scores 365. (Note !! This is the test result on my computer, the different network node network speed will be large, so this score does not necessarily apply to other computers)

Add the NetSelect found to join the speed of connection to the /etc/apt/sources.list file (see the /etc/apt/sources.list file, section 2.) And Follow The Tips In Managing Packages, Chapter 3.

Note: The mirror site list is usually included in the file.

http://www.debian.org/mirror/mirrors_full.

From version 0.3, the NetSelect package contains a NetSelect-Apt script that automatically completes the above operation. Simply use the publisher tree as a parameter (default as a stable), the Sources.list file generates the fastest MAIN and NON-US mirror site list and saves in the current directory. The following example generates a sourceS.List containing a list of stable issued a mirror site.

Bash $ ls sources.list

Ls: Sources.List: File or Directory Not Found

Bash $ NetSelect-Apt Stable

(...)

Bash $ ls -l sources.list

Sources.list

Bash $

Remember: Sources.list is generated in the current directory, you must move it to the / etc / apt directory.

THEN, FOLLOW the TIPS in Managing Packages, Chapter 3.

2.4 Join the CD-ROM to the Source.list file

================================

If you install and upgrade the package from the CD-ROM with a APT, you can add it into the Sources.list file. Complete this operation, you can use the APT-CDROM program:

Apt-CDROM add puts the Debian disc into the CD-ROM drive, which will load the disc directory and find the package information on the CD. If your optical drive requires additional settings, you can use the following options:

-H - Program Help

-d Directory - CD-ROM MOUNT POINT

-r - rename a recognized CD-ROM

-m - no mounting

-f - fast mode, Don't Check Package Files

-a - Thorough Scan Mode

E.g:

Apt-cdrom -d / home / kov / mycdrom add

You can also scan a disc, but don't add it to the list:

Apt-CDROM IDENT

Note that the program will only work if you have properly set the optical drive correctly in the system / etc / fstab.

转载请注明原文地址:https://www.9cbs.com/read-70969.html

New Post(0)