Three methods for creating the Ubuntu Deb package

Source: Internet
Author: User

I. Use Deb package

1. view the files contained in Deb (not installed)

$ Dpkg-c xxx. Deb // view it according to the Deb file before installation

$ Dpkg-l debname // view the package name after installation

2. Install the Deb package

$ Dpkg-I XXX. Deb

Note: if an error is prompted, you can add the-force-All parameter to force the installation, but this is not recommended.

3. view which Deb package a file belongs

$ Dpkg-s filepath

4. Remove the Deb package

$ Dpkg-r debname

Ii. Prepare a deb package

1. Principle

1) The Deb package usually contains two parts: the control information (Debian directory) and the installation content (simulate the root directory)

2) Check the content of the existing Deb package.

I. Release the installation content to the dirname directory.

$ Dpkg-x XXX. Deb dirname

Ii. Release control information to the Debian subdirectory in the current directory

$ Dpkg-e XXX. Deb

2. Prepare

1) lab platform

Ubuntu 8.04

2) install related tools

$ Apt-Get install DH-make checkinstall

3) download the sample Software Package

Take the game simulator as an example (you can also use other source code packages) to create its Deb package ,:

Http://prdownloads.sourceforge.net/fceultra/fceu-0.98.12.src.tar.bz2

4) Note: We recommend that you use Autoconf and automake to generate the compiling script for the code you have written. For details about the routines, see

Http://xy0811.spaces.live.com/default.aspx? _ C01_blogpart = blogentry & _ c = blogpart & handle = CNS! F8aecd2a067a6b17! 1002

3. Method 1: Use the checkinstall method to create a deb package

Checkinstall not only can generate Deb package, but also can generate RPM package, simple to use, but not flexible, feature rough, only for introduction, not recommended

$ Tar xvjf fceu-0.98.12.src.tar.bz2 // unpack

$ CD fceu;./configure; Make // compile

$ Checkinstall-D-y-install = No-pkgversion-0.98-pkgname = fceuxy-pkgcource =./-showinstall = No-default make install // make Deb package

The Deb package is generated in the current directory.

4. Method 2: Use dpkg to create a deb package

Dpkg is the most basic method for creating a deb package. We recommend that you use

$ Tar xvjf fceu-0.98.12.src.tar.bz2 // unpack

$ MV fceu fceu-0.98 // Change directory name package name-version number

$ Fceu-0.98 CD

$ Dh_make-s-e xieyan0811@sina.com.cn-f ../fceu-0.98.12.src.tar.bz2 // generate the default information required to make the Deb package

At this time, the Debian directory is generated under the current directory. At this time, two files are usually modified:

Modify the Debian/control file and configure your information. For specific fields, see the reference section.

Modify the Debian/rules script, which determines the compilation parameters (or not)

$ Dpkg-buildpackage-rfakeroot

Now we can see that the Deb package has been created in the upper-level directory.

5. Method 3: Modify the existing Deb package

Create the directory structure (control information and installation content) required by Deb and package it. This method is generally used to modify the existing Deb package instead of creating a new Deb package. The command is as follows:

$ Dpkg-x XXX. Deb test // unpack the installation content

$ CD Test

$ Dpkg-e ../xxx. Deb // unpack control information

Modify content

$ CD ../

$ Dpkg-B dirname xxx_new.deb // repackage

Iii. References

1. Debian/Control File Information Description

1) package name

2) version

3) architecture target machine architecture (i386, arm, etc)

4) maintainer

5) depends dependent Software Package

6) Description

2. checkinstall detailed routine

Linux/L-CN-checkinstall/index.html "> http://www.ibm.com/developerworks/cn/linux/l-cn-checkinstall/index.html

3. Make your own Deb package routine

Http://blog.chinaunix.net/u2/78998/showart.php? Id = 1404403

4. Official Debian Production Manual (relatively long)

Http://www.debian.org/doc/manuals/maint-guide/index.zh-cn.html

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.