In this tutorial we will be using the Electron installer debian package to create a debian package. This tutorial expects you to have packaged your app already. If you haven’t, you can check out the Electron packager tutorial.
1. Installing the package
Start by installing electron-installer-debian package:
2. Create config file
Then create a new file called debian.json that will contain settings we need to create the package.
dest we set where the .deb package will be saved.
icon options points to an icon the app will get.
categories sets the category where the application will be seen in menus. I’ve choosen Utility for this app since there is no real good place for it. You can take a look at the available categories for your app.
lintianOverrides is used to quieten Lintian, which is a debian package checker.
3. Package the app
Now we need to make sure we have a packaged app. First I need to make an update to the packager script since I’ve missed a setting there. Thank you Felipe Castillo for the help!
The package script called
package.json that currently looks like this:
Needs to be updated with a setting called appname. So it will now look like this instead:
Now we can run the package script:
4. Creating the debian package
When the electron-packager is finished, we can run the electron-installer-debian to create a .deb package.
src points to the folder where the packager saved the app.
arch tells electron-installer-debian which architecture to build for.
config points to the file containing the settings we defined in step 2.
5. Adding script to package.json
So that we don’t need to remember the electron-installer-debian command everytime we can add it to package.json below
Now we can run
This is what the package-installer looks like in Mint Linux when opening