Managing packages in Linux distribution varies depending on the distribution. All the Debian-based distros use APT as the package management app. While Fedora uses DNF, openSUSE depends on Zypper package manager.
Recently, distro-agnostic package managers like Snap, Flatpak, AppImage, etc. made the scene even more fragmented.
More package managers mean more commands to get familiar with.
If that's what you feel as you distrohop around the Linux-verse, I have a new app for you. It's called app π¬
App, a cross-platform package management assistant written in Go, can help you in this scenario. Basically it is a wrapper for package managersand offers the same commands on all supported distributions. It means you don't need to memorize per-distro package management commands.
That's not it. The app keeps a record of installed applications in its config file. So, if you move distros, just use the previous config file to install the same packages in the new distro.
Install App Package Management Assistant
The App provides an installation script, which you can install on any Linux distribution. Open a terminal and run the command below:
bash <(curl -sL https://hkdb.github.io/app/getapp.sh)
To update the app to the latest version, use:
app -m app update
What happens behind the scene
App utility has its own simpler syntax. Since the utility uses the same syntax across distributions, you only need to remember the syntax of App utility.
When you install an app using the app
command, it records the action. Be it an installation or removal of the package, the information is stored inside the ~/.config/app
directory.
Now, when you want to migrate to another distribution, you can copy this directory and paste it inside the ~/.config
folder of the new distribution to start installing packages. We will see the process in detail in the next section.
Basic App utility commands
Let's see some of the important commands you need to remember while using this tool.
Enable/Disable necessary package managers
By default, package managers like Flatpak, Snap, AppImage, Yay, Pip, Go, and Cargo are disabled.
You can enable them using the general syntax:
app -m <package-manager> enable
For example, to enable Flatpak support,
app -m flatpak enable
To disable an enabled package manager, use the command:
app -m <package-manager> disable
Search for packages
In order to search for packages using the App utility, do the following:
app search <package-name>
To search for a package on another package manager like Flathub, specify the package manager.
app -m <package-manager> search <package-name>
For example, if I am searching for Blackbox terminal emulator in Flatpak, I will run:
app -m flatpak search blackbox
Install a package
To install a package on your system, run the command:
app install <package-name>
Let's say I want to install fortune
. So I will run:
app install fortune
Install apps from other package manager
To install an app as a Flatpak, use the command:
app -m flatpak install <package-name>
This is a general formula, so, we can install packages from other package managers using:
app -m <package-manager> install <package-name>
Install an AppImage
First go to the directory where the AppImage file is downloaded. Now, to install the AppImage file:
app -m appimage install <appimage-file-name>
I have an AppImage of Standard Notes app. So, I will open my Downloads directory in a terminal and run:
app -m appimage install standard-notes-3.195.1-linux-x86_64.AppImage
On the official page, you have a detailed description of all package managers that are supported and respective installation methods.
List installed packages
You can list the packages that were installed using App from official repos by using the command:
app history
Similarly, to list all the installed packages from a particular repository, run:
app -m <package-manager> history
Remove a package
To remove a package, you can use:
app remove <package-name>
For other package managers, use:
app -m <package-manager> remove <package-name>
If you are on a Debian-based distribution, you can use purge
as well.
app purge <package-name>
Similarly, App
supports autoremove
for native package managers.
app autoremove
Upgrade packages
To upgrade all the packages installed on the system, use the command:
app update
app upgrade all
At the same time, the App allows individual package manager upgrades as well. For this, use the syntax:
app -m <package-manager> upgrade
Add PPA in Ubuntu
In an Ubuntu-based system, you can use PPA to install additional packages that are not available in the native Ubuntu repositories or there are old versions available in the repos.
So, if you are using the App for installing packages, you need to use the syntax:
app add-repo ppa:graphics-drivers/ppa
Restoring the packages in another distro
Now, when you want to hop to a new distro, or want to replicate the current distribution, all you need to do is described below.
First, install the App utility on the new system, as mentioned in the first section.
Now, copy the ~/.config/app
directory to the new system. Then open a terminal and run:
app -r all
That's it. Your packages will be installed on the new system.
~/.config/app/packages/flatpak.json
file, there was an additional space present on the beginning of the line.I removed that space and rerun the command to restore Flatpak apps successfully.
You can restore individual package managers separately by using the command:
app -r <package-manager>
Conclusion
This seems like a useful tool if you distrohop quite often. You can get the list of the packages you install regularly and you can install them with less effort on a new system.
There are a few tools like Nala that try to provide similar features.
By the way, we are also offering Linux courses through our other portal. Something you might be interested in.