How to create .deb packages for Debian, Ubuntu and Linux Mint

HomeOther ContentHow to create .deb packages for Debian, Ubuntu and Linux Mint
How to create .deb packages for Debian, Ubuntu and Linux Mint
How to create .deb packages for Debian, Ubuntu and Linux Mint
How to create Debian packages

Note: The commands shown here are for example purposes only. They will NOT work as shown here. You must adapt them to your own needs and your system.

1. Create the directory to contain the project:

shell) mkdir /home/USER/debpkgs/my-program_version_architecture

2. Create a directory called /"DEBIAN/" in the project directory:

shell) mkdir /home/USER/debpkgs/my-program_version_architecture/DEBIAN

3. Copy the files to the project root directory and include the final paths:

/usr/bin/ would be /home/USER/debpkgs/my-program_version_architecture/usr/bin/

/opt/ would be /home/USER/debpkgs/my-program_version_architecture/opt/

4. Create a control file in DEBIAN:

shell) touch /home/USER/debpkgs/my-program_version_architecture/DEBIAN/control

5. Now add the necessary metadata to the control file:

Package: my-program
Version: 1.0
Architecture: everything
Essential: no
Priority: optional
Depends: packages;my-program;needs;to;execute
Responsible: your name
Description: A brief description of my program that will be displayed when the package is selected for installation.

6. If desired, a /"preinst/" and/or /"postinst/" script can be added and will run before and/or after installation. They must have the appropriate execution permissions to run:

shell) touch /home/USER/debpkgs/my-program_version_architecture/DEBIAN/postinst

Add the commands you want to run in postinst, then set the permissions to 755.

7. Now generate the package:

shell) dpkg-deb –build /home/USER/debpkgs/my-program_version_architecture

The package will be in /home/USER/debpkgs
Visit https://www.ezeelinux.com to learn more about Linux.
Please join the discussion on EzeeTalk.
https://www.ezeelinux.com/talk/ It's free, secure and fun!

Please take the opportunity to connect and share this video with your friends and family if you find it useful.

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *