How difficult is this?
Not so difficult at all. I do all my packaging from scratch. Once you know a few tools, and understand what's going on, the process is fairly simple. Be prepared to spend some time, learning the processes, though.
Do I need to create my own repository for this to work?
A repository (such as a PPA) is for publishing your package to the wider world. So, yes, if you want people to be able to install the package, either you need to get it included in Debian/Ubuntu, or you need to publish it in a repository.
PPAs also have access to the Launchpad build farm, so they can build binary packages from source packages. But you can do this locally, too. And while packaging something, you really want to be test-building locally, rather than waiting for LP to build your package (the LP build queues can be hours long).
Do I need to sign it with my public key or something?
If you want to upload to a PPA, you need to sign your source package with your private key.
Will one deb package work for all Debian-based distributions, or do I need to build a separate version for each flavour?
The safe answer is no. But sometimes it's fairly straightforward to produce once deb that will work on all current Debian and Ubuntu releases. It depends on the package and the toolchain you used.
I suggest:
Snap attempts to solve one of the fundamental problems with Linux as a desktop operating system: software availability and software distribution. Snap is not intended to completely replace debs, however. Snaps and Debs work alongside each other.
I am a Linux enthusiast and a project manager of a Linux application. While I love Linux systems as a whole, I can't stand the current state of package distribution. Universal App Formats like Snaps aim to solve this fundamental problem.
In Linux, packages are specifically built for a single version of a single distribution. With a lot of tweaking, it is possible to make one .deb
package that runs on all Debian based systems, but this is complicated and limits developers. It's also not practical at times due to version locking of dependencies.
If I create a deb package for Ubuntu 20.04, it will only work on that version. I also have to make a different package for 16.04, 18.04, 20.10 and so on. I already have to make four packages just for Ubuntu. I also need to make one for every Debian version, every Fedora version and every openSUSE version. RPM is more flexible in this regard but the locked dependency issue still gets in the way.
This means if I want to release a new version of my application, I have to create over 20 packages to cover the majority of Linux distributions, and that still won't cover every distro. A second possibility is to wait for distribution maintainers to add your package to the distribution but this usually takes an absurd amount of time. Moreover, then the distribution maintainers decide which version their users get instead of the software developer.
With Snap, a single package runs on every version of every distribution that supports snap. See Installing snapd for a list of many distros that support it.
Additionally, with Snap, the developer publishes and maintains the package, instead of the distribution maintainer. So I as a developer can release new a version to all my users without having to wait on anyone else.
Essentially, everything I hate about Linux package distribution is solved by Snap. Though it's important to note that these core issues are also being solved by Flatpaks & to a degree by AppImages. The discussion for which format is better is highly debated and a much longer conversation than makes sense for this reply. For now, I will say that I am fine with running any of the universal formats since they all work differently and thus do not conflict with each other making it possible to run all 3 and traditional packages at the same time.
TL;DR
Linux package distribution is awful for both developers and users. Snaps, Flatpaks & AppImages are intended to solve this fundamental problem with Linux based systems.
This question is really about why the move but if anyone is interested in learning more about what Snaps are and how they work. I created this video to explain the structure in-depth.
Best Answer
Why did Canonical chose snaps?
To quote the Ubuntu website:
Essential idea was to fix issues that are present in both
.deb
packages and provide new method for updating the packages (the so called transactional updates , very similar to how android apps are updated). As Mark Shuttleworth explains:What are the main advantages of .snap packages over .deb packages?
The biggest advantage is the improved security. PPAs and
.deb
packages are typically installed with root privillege , which opens up a venue for security risks.Snappy apps are isolated, meaning that if some app breaks, it won't break your systems. To quote Mark Shuttleworth:
Will .deb be abandoned?
As of Ubuntu 16.04 LTS , both methods are available to the users.
To quote OMG! Ubuntu!: