How to distribute our software on Ubuntu and other distros

If you are programmers or not and want a method to install that application or script, here are several methods.
DEB Package with Fonts (Only for debian and Derivatives)

This method is for when we have the source code of the application.

First we install the program that does the magic "Checkinstall", in a terminal we execute

sudo aptitude install checkinstall

For the example we will use the library "LAME", download the font from here, we create a folder and place the file lick-3.98.4.tar.gz and from terminal as root we enter that folder and execute these lines.

tar -xzvf lame-3.98.4.tar.gz cd lame-3.98.4 ./configure make checkinstall cp * .deb ../ cd .. rm -R lame-3.98.4 chmod 777 lame-3.98.4 *. deb

It generates the deb package for us, this method installs the generated package at the end.

Manual DEB Package (Only for debian and Derivatives)

This method is for our precompiled scripts or applications

Structure of a DEB Package

| Setup (General Folder) | | -DEBIAN (Folder where the Configuration files are) | --control (Configuration file) | --preinst (File or Script that runs before Install) | --postinst (File or Script that runs after Install ) | --prerm (File or Script to run before uninstalling) | --postrm (File or Script to run after uninstall) | | -usr (Folder where your application files are) | -usr / bin (Folder where the binaries or scripts are) | -usr / share / pixmaps (Folder where the icons are) | -usr / share / applications (Folder where are the launchers)

Example of «control» file

Package: TUPACKAGE Version: VERSION Architecture: amd64 (i386 or all) Maintainer: AUTHOR Section: partner / web Priority: optional Description: TEXT

Generating a DEB Package

sudo chmod -R root: root setup / sudo chmod -R 755 setup / sudo dpkg -b setup / package.deb chmod 777 package.deb chown -R setup

With this data we can now generate a deb package for our application, as an example we are going to make a simple bash script

We create a folder named «ubunlog» and within this other name Setup
then inside the last folder we create two folders one of name "DEBIAN" and other «Usr».

This is the control file

Package: ubunlog-web Version: 0.11.5.13 Architecture: all Maintainer: TU NAME Section: partner/web Priority: optional Description: Tutorials, Linux desktops, software, news and everything about Ubuntu

We keep it inside the folder "DEBIAN" that we created before as «control»

This code is from the postinst file

#!/bin/sh chmod 755 /usr/bin/ubunlog-web chmod +x /usr/bin/ubunlog-web chmod 755 /usr/share/pixmaps/ubunlog-web.png chmod 755 /usr/share/applications/ubunlog-web.desktop chmod +x /usr/share/applications/ubunlog-web.desktop

We save this in the same folder as before as "postinst"

Now we create the folders for the script, the launcher and the icon, inside the folder Setup we create a folder named «Usr»

As you can see we have two folders one "DEBIAN" and other «Usr» that we created seconds ago, within the latter we create folders one "Bin" and other "Compartir"

This is the script code

#!/bin/sh firefox https://ubunlog.com/ &

we save it in the folder "Bin" with the name «ubunlog-Web".

Now we go to the folder "Compartir" in this we create a folder named "Pixmaps" and we save with the name «ubunlog-web.png» we downloaded this image from here

We only have to create the launcher, for this we create a last folder within share by name "Applications"

This is the code of the same

[Desktop Entry] Encoding=UTF-8 Name=Ubunlog Web Blog Comment=Tutorials, Linux desktops, software, news and everything about Ubuntu GenericName=Tutorials, Linux desktops, software, news and everything about Ubuntu Exec=ubunlog-web Terminal=false Type=Application Icon=ubunlog-web Categories=Application;Network;Internet; StartupWMClass=ubunlog-web StartupNotify=true

They keep it in the folder "Applications" as «ubunlog-web.desktop»

We already have everything ready, it only remains generate deb package, prompts you for root password, but doesn't install anything.

sudo chmod -R root:root setup/ sudo chmod -R 755 setup/ sudo dpkg -b setup/ ubunlog-web_0.11.5.13_all.deb chmod 777 ubunlog-web_0.11.5.13_all.deb chown -R setup

If everything is correct, you already have the package «ubunlog-web_0.11.5.13_all.deb».

Self-extracting Manual (Only tested on Ubuntu, Works on Any Distro)

This method is to generate files with the makeself script (http://megastep.org/makeself/)

They download from the web, it is a .run file, they give it permissions and we execute it,

How to use it.

makeself.sh FOLDER / SOURCE / RESULT.RUN "TEXT" ./setup.sh

As you can see "FOLDER / ORIGIN / » are the files and folders of our application or script «RESULT.RUN» is the resulting file or Self-extracting file
"TEXT" is the message that is displayed when you run the Self-extracting file, and it is enclosed in quotation marks.
"./Setup.sh" is the script that runs when unzipping the Self-extracting file, don't forget to give it permissions.

To make it more understandable we will use the same example of the deb package but adapted to it.

We create a folder named «ubunlog» and we copy the folder that makeself generated, rename it as Makeself
In the folder «ubunlog» create another name setup and inside this place the following files.

Installer Script

#!/bin/sh cp ubunlog-web /usr/bin/ chmod 755 /usr/bin/ubunlog-web chmod +x /usr/bin/ubunlog-web cp ubunlog-web.png /usr/share/pixmaps/ chmod 755 /usr/share/pixmaps/ubunlog-web.png cp ubunlog-web.desktop /usr/share/applications/ chmod 755 /usr/share/applications/ubunlog-web.desktop chmod +x /usr/share/applications/ubunlog-web.desktop

They save it as setup.sh

Our Script

#!/bin/sh firefox https://ubunlog.com/ &

They save it as "ubunlog-web» the icon is saved with the name «ubunlog-web.png» we downloaded this image from here

The pitcher

[Desktop Entry] Encoding=UTF-8 Name=Ubunlog Web Blog Comment=Tutorials, Linux desktops, software, news and everything about Ubuntu GenericName=Tutorials, Linux desktops, software, news and everything about Ubuntu Exec=ubunlog-web Terminal=false Type=Application Icon=ubunlog-web Categories=Application;Network;Internet; StartupWMClass=ubunlog-web StartupNotify=true

They save it as «ubunlog-web.desktop»

Now we generate the Self-extracting file

chmod 755 setup/ chmod +x setup/setup.sh sh ../makeself/makeself.sh setup ubunlog-web.run "Ubunlog - Tutorials, Linux desktops, software, news and everything about Ubuntu" ./setup.sh

We already have the self-extracting file.

I hope this helps you with something

Thank you for your Comments, If there is any ERROR it is the product of your imagination, hahaha


Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   David Gómez said

    Excellent manual, congratulations ...

  2.   Let's use Linux said

    Excellent article Luciano!
    I really congratulate you.
    A hug! Paul.

  3.   maty1206 said

    Congratulations! This article is one of the best I have seen to learn how to package .deb binaries for Debian and derivatives like Ubuntu.

    In the case of ArchLinux we use the PKGBUILD in the best BSD style: https://wiki.archlinux.org/index.php/PKGBUILD_%28Espa%C3%B1ol%29

    Take care!

    1.    Luciano Lagassa said

      Hello, thanks for your comment, if you think we can add in the post how to create packages for arch, I clarify that I only use ubuntu and a little centos, I comment that it is very good I tried once but I did not have the time to install it, for which would be very good since if I can anyone can.

  4.   Luciano Lagassa said

    Hello, thanks for your comments, as I have already mentioned on other occasions, my post is based on my experiences, I hope they are useful.

  5.   Josh said

    Hi luciano.

    I have started to follow the steps and I have not been able to pass the checkinstall. It returns the following error:

    "Makefile: 349: recipe for target 'install-recursive' failed
    make: *** [install-recursive] Error 1

    **** The installation failed. Aborting the creation of the package. "

    Before that, the "make" command shows this in the output:

    "Make [3]: Nothing to be done for 'all'."

    I don't understand what is failing. I have tried to download the most current version of LAME to see if it would solve my problem, but nothing to do.

    Greetings.