We all like to use apt-get, because it really saves us a lot of effort. However, sometimes we are worried about slow network speeds and poor installation sources. Therefore, we may save the Deb files of some common software packages locally for emergency purposes. Of course, dpkg can also be used to directly install the Deb Software Package stored locally. The problem is that it cannot process dependencies between software packages, so how to use apt-get to install the local software package and source code?
The following describes how to use the local Deb file with APT-get:
Step 1: Put all your Deb files in the same directory, for example:
# Mkdir/var/Debs
Step 2: Use the dpkg-scanpackages command to generate a software package index file that can be used by APT
/Var # dpkg-scanpackages Debs/dev/null | gzip> Debs/packages.gz
Note: The/dev/null parameter specifies a file with unlimited file names. This file is used to override some definitions of the control file in the Deb software package, the format of its first line corresponds to a software package:
Package priority section
Package specifies the software package you want to modify
Priority has three values: low, medium, and high.
Section is used to specify which section the software package belongs.
If you do not need to modify the Deb package, you can specify a/dev/null file as in the example.
Step 3: Add a row in your sources. List
Deb file:/var Debs/
In this way, you can use the apt-GET command to install these software packages. The command format is not different. APT-Get will process dependencies between software packages for us, modify sources. after list, you must execute the apt-Get update command.
The same is true for apt-Get installation using local source code. Note the following points:
1、orig.tar.gz (source program file),. DSC (Debian control file) and .diff.gz (description of the changes required before Debian can use the program) files must be in the same directory.
2. The generated index file must use sources.gz, but cannot use packages.gz
3. the scanner uses dpkg-scansources
# Dpkg-scansources Debs | gzip> Debs/sources.gz
4. Add a row in sources. List.
Deb-Src file:/root Debs/