How to implement auto-update electron app on Linux?

There really is nothing standard in the *nix world. You will always have to support specific ditributions, and each of these distribution can in turn have multiple possible ways of creating an auto-updater.

To your questions:

  1. There is no standard way.

  2. That depends on your way of actually distributing he package. If you plan on using package managers like rpm/apt-get/apt install, then each of these managers has a specific way of configuring your application to be among those packages that are checked for automatic updates.

  3. Difference between .rpm / .deb:

    Main difference for a package maintainer (I think that would be 'developer' in Debian lingo) is the way package meta-data and accompanying scripts come together. Link

    Difference between Ubuntu & Fedora: As creating a detailed answer on this questions would both be too lengthy and too much effort to maintain, check out this blog post detailing the differences between these two distributions.


You can try electron-simple-updater if AppImage format is ok for your project.


Appimages

You can use electron-builder to create Appimages to install or auto-update you application almost in any Linux distribution

AppImage is a universal software package format. By packaging the software in AppImage, the developer provides just one file ‘to rule them all’. End user, i.e. you, can use it in most (if not all) modern Linux distributions

If you want to auto-update your app you will also need electron-autoupdater. Targets:

  • MacOS: DMG.
  • Linux: AppImage
  • Windows: NSIS

You can find an example of a project that uses this here. The important files: package.json, updater.js, updater_renderer.js

With some of these instruction you can create the installers:

yarn electron-builder --linux --x64
yarn dist_linux                        # shortcut in package.json

deb, rpm

You can create packages such as deb or rpm with electron-builder, but to autoupdate them depends on how you distribute them as Jens says in his answer. The final user may need to add an apt repository to keep up to date


Answer from Jens is really the best.

But if you do not want to spend your time with learning RPM and DEB and building packages for all distribution, then you may consider package your application using Flatpak. http://flatpak.org/#about

It create one big archive which can be run on Ubuntu, RHEL.... Everywhere.