DEV Community

ihucos
ihucos

Posted on

Install any package with ZPKG

There is a really cool (meta) package manager I wrote. Usually you are kind of bound to specific package managers depending on your Linux distribution of choice. With ZPKG you can just use any package manager on any Linux distribution. It is still alpha/beta but already works fairly well. Let's take a look.

Let's take the exemplary use case that you are on Ubuntu Linux and want to do some quick image editing with Gimp. You totally could install that with apt or snap, for example:

apt-get install gimp

While that is the "official" way of doing that and apt does a fairly good job, there are still some things I don't like so much.

  • You have to use the root user. I personally try to avoid that.
  • The package integrates into the system and e.G. creates new users, installs services, configuration files etc. That could be desired, but causes "bloat" on the whole system.
  • Ubuntu packages are stable, but sometimes a little outdated (imho) in comparison to other distributions.
  • I find apt slow in comparison to e.G. apk from alpine. Big packages can take up quite some time.

So what I do in that specific use case of just quickly wanting Gimp to edit an image or so without putting too much weight on my global system installation, is to use ZPKG. Let's takes a look:

zpkg add gimp --from alpine:edge --apk gimp

Or a shorter less explicit invocation

zpkg add -A gimp

Note:
Make sure you have this directory in your PATH: $HOME/.local/bin

And voilà you can type gimp in any terminal in order to use it. Interestingly the whole installation is on your home folder and completely independent from the Linux Distribution or it's libc implementation. So you could do things like share your home folder across multiple Linux Distributions and still use the same programs.

Another thing that I think is pretty nice, is that with zpkg you can also package other packages. Let me explain:

$ zpkg package gimp gimp.zpkg  # that is the "gimp" we just installed
Install package locally:
tar -xf gimp.zpkg -C ~/.local 

Install package globally:
tar -xf gimp.zpkg -C /usr/local

ZPKG itself is distributed as a zpkg package, so this is how to actually install it:

curl -Lf https://github.com/ihucos/zpkg/releases/download/0.2.4/zpkg.zpkg | tar -xJf - -C ~/.local

So in other words, with ZPKG you can also create packages, that are completely distribution agnostic.

Of course you can also do stuff like upgrading installed packages, removing them, and so on. Check it out :-)

The implementation details include overlay filesystem, user namespaces, hard links and other interesting topics that I will hopefully follow up on more posts :-)

Here is the website and the GitHub page
http://zpkg.plash.io/
https://github.com/ihucos/zpkg

Top comments (2)

Collapse
 
projectescape profile image
Aniket

I love how more and more inter distro package manager solutions are coming up. What do you think makes ZPKG better than AppImage, Flatpak, snap ( I hate snap ) ?

Collapse
 
ihucos profile image
ihucos

Hey! I actually never did look into that solutions well enough to have too strong opinions. What I like about ZPKG, is that you don't have to learn so much new. So if you have any reproducible way to install any software in any linux distribution, that is already enough to create an ZPKG package. For example

$ zpkg add myprog --from ubuntu:focal -x ./installme.sh
$ zpkg package myprog myprog.zpkg  # then you can distribute the myprog.zpkg file.

So I'd say the unique selling point for ZPKG is simplicity and relying on what you already know.