Package existing files into a deb package in Ubuntu

Source: Internet
Author: User
Deb is the package format of Debian Linux. In general, we need to compile the source code and then create a deb package. Today, due to work needs, we want to package some existing files into a deb package, so we are struggling to find and study how to deal with it, finally, a package was created at three o'clock P.M. And practice it by yourself to ensure the correctness of each step and the final result. Details are as follows: I am operating on Ubuntu7.10. to package the files under the/usr/src/soft directory, these files will be released to/usr/src/sof when the package is unwrapped.

Deb is the package format of Debian Linux. In general, we need to compile the source code and then create a deb package. Today, due to work needs, we want to package some existing files into a deb package, so we are struggling to find and study how to deal with it, finally, a package was created at three o'clock P.M. And practice it by yourself to ensure the correctness of each step and the final result. The details are as follows:

I am operating on Ubuntu 7.10 and want to package the files under the/usr/src/soft directory. When I unpack the files, they are also released to the/usr/src/soft directory.

First, create a working directory, for example, create a work directory under the user lionel directory:

# Cd/home/lionel
# Mkdir work
# Cd work

When installing the software package, the file is released to the root directory by default, so you can set its path, and we also need to create a DEBIAN directory:

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

A key step is to create a control file in the DEBIAN directory using the following method and add the following content to it:

# Cat> DEBIAN/control <Package: soft
Version: 1.0.1
Section: utils
Priority: optional
Architecture: i386
Depends:
Installed-Size: 512
Maintainer: Linuxidc@126l.com
Description: soft package
EOF

Then you can use the dpkg command to build the deb package:

# Dpkg-B./home/lionel/soft_1.0.20.i386.deb

The generated package is in the/home/lionel directory.

From the perspective of the whole process, the control file is very important, so we need to ensure its correctness. For the specific meaning of the metadata and why the data is needed, I will take a closer look at it later. Note that each command is prefixed with "#". You must use the root permission to perform these operations.

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.