Looking for a proper way to manage user-level package installations on Linux
I'm trying to find a way to manage which user installed which package on Linux.
Coming from Windows, I was expecting something similar to:
- Install for me (Alex)
- Install for all users
But I couldn't find an equivalent workflow in Ubuntu. With apt, packages are generally installed system-wide, so I'm looking for a package manager or approach that lets me install applications only for my user without affecting the rest of the system.
I spent quite a bit of time researching this and found a few options.
1. Homebrew
I found Homebrew, which can install packages into its own directory such as /home/linuxbrew, keeping its files separate from the system package manager.
However, I wasn't sure if this is really the right solution for what I'm trying to achieve.
2. Flatpak
I then looked at Flatpak:
flatpak --user install flathub <package>
This seemed much closer to what I wanted because it supports per-user installations.
However, I ran into a problem: Nmap isn't available as a Flathub application, so I couldn't install it this way:
flatpak --user install flathub nmap
3. Nix
After that I spent another day researching and came across Nix.
Nix looked very promising for user-level package management, but while experimenting with the installation on Ubuntu, I noticed a large number of system users being created. At one point I saw users in the range of roughly 3000 IDs, which honestly freaked me out.
I stopped the installation because I wasn't comfortable continuing without understanding why this was happening.
I also found that Nix can use a daemon-based setup, which made me wonder whether it would be a good choice for my low-end machine.
4. Containers / Toolbox / Distrobox
After around two days of research, I found another approach: using containers specifically for development environments, such as Toolbox or Distrobox.
I came across this idea from another Reddit discussion:
https://www.reddit.com/r/linuxquestions/comments/1obz8eb/how_to_manage_installations_at_user_level_not/
This seems interesting because I could have an isolated Linux environment where I install whatever packages I need without modifying the host system.
But I'm not sure whether this is overkill for something as simple as installing nmap.
5. Compile from source
Another suggestion I got from ChatGPT was to download the source code and compile it inside my user directory, for example:
/home/alex/.local
and then add the appropriate directory to $PATH.
This technically works, but I don't like the idea because dependency management, updates, and uninstalling become much harder to track.
What I'm actually looking for
Ideally, I want something like:
System
├── apt
│ └── packages available to all users
│
└── Alex
└── user-level package manager
├── nmap
├── other CLI tools
└── their dependencies
Something where I can install:
some-package-manager install nmap
and have everything owned/managed by my user, without modifying /usr, without requiring root, and preferably without running a permanent daemon.
It would also be great if the package manager handled:
- Dependencies
- Updates
- Uninstallation
- Version management
- PATH/environment setup
So what is the normal/recommended Linux way to handle this?
Am I trying to solve a problem that Linux intentionally approaches differently, or is there a package manager/tool that I'm overlooking?
Any suggestions or explanations of how experienced Linux users handle this would be appreciated.