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.
With dest
we set where the .deb package will be saved.
The 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.
There are a lot of other options you can set. You might want to check how to set for example dependencies. But this will currently be enough for the Electron tutorial app.
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-linux
in 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 create-installer-win
:
Now we can run
This is what the package-installer looks like in Mint Linux when opening release-builds/electron-tutorial-app_0.1.0_amd64.deb