Ubuntu uses apt-get to install the local Deb package

Source: Internet
Author: User

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/

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.