Three methods for creating a deb package

Source: Internet
Author: User
Three methods for creating the deb package-Debian, the Linux release technology. For more information, see the following. I know there are three methods to create a deb package. One is to package an existing file. Installing this package is like releasing the package file to a directory; the second is to package the deb source code. The third is to package the makefile source code. Installing this package is equivalent to compiling and installing the software with the source code.

1. method 1 ----- package existing files:
For example, you want to package the/usr/src/soft directory of your current debian system, and then install it on another debian system.

These files are also released to the/usr/src/soft directory when the package is changed:

Create a working directory under any directory, such as root, or work

# Cd/root
# Mkdir work
# Cd work

Because the file is released to the root directory by default during the installation package, we have set its path:

# Mkdir-p usr/src
# Cp-a/usr/src/soft usr/src
# Mkdir DEBIAN

Use the following method to create a control file in the DEBIAN directory and add the following content:

# Cat> Add the deb-src entry to the DEBIAN/control/etc/apt/sources. list file.

Then, run the command

# Apt-get update or # aptitude update:

# Apt-get source packagename or # aptitude source packagename

Three files are downloaded: .orig.tar.gz,. dsc, and .diff.gz. For Debian-specific software packages, the last file will not be downloaded. The file name of the first file does not contain the "orig" item.

Dpkg-source reads the. dsc file information and unpacks the source code package to the packagename-version directory. The downloaded source code package contains a debian/directory, which is the file required to create the. deb package.

For example:
$ Apt-get source nano
Reading package lists... DoneBuilding dependency tree...
DoneNeed to get 1199kB of source archives.
Get: 1
Http://ftp.us.debian.org
Testing/main nano 1.3.11-2 (dsc) [706B]
Get: 2
Http://ftp.us.debian.org
Testing/main nano 1.3.11-2 (tar) [1173kB]
Get: 3
Http://ftp.us.debian.org
Testing/main nano 1.3.11-2 (diff) [25.4kB]
Fetched 1199kB in 3m46s (5287B/s )......
Dpkg-source: extracting nano in nano-1.3.11
Dpkg-source: unpacking nano_1.3.11.orig.tar.gz
Dpkg-source: applying./nano_1.3.11-2.diff.gz

After the corresponding adjustment, in the source code of the root directory nano-1.3.11 run:

# Dpkg-buildpackage-rfakeroot-uc-B compile the code into a software package.

To automatically compile the source code package to a software package, you only need to add-B to the command line. For example:

# Apt-get-B source packagename run the preceding command in the directory where the downloaded package is located.

# Dpkg-I file. the source command of debapt-get is different from other commands of debapt-get. You can run the source command with normal user permissions, the specified file is downloaded to the directory where the user calls the apt-source package command.

3. The third method is to package with the makefile source code.
Use the make command to compile in the directory where the source code is located, and then use the checkinstall command to package.

If you do not have the checkinstall command, you can install apt-get install checkinstall first.
Related Article

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.