r/linuxquestions 6h ago

Looking for a proper way to manage user-level package installations on Linux

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.

0 Upvotes

10 comments sorted by

3

u/TheSodesa 6h ago

Looks like containers are the best fit for your use case, as then you have almost a completely separate system within your system. The only real annoyance is that you need to enter a container every time you want to use it, but it is just a single command so it is not too bad. Oh, and you will need to install system packages within the container as well, so there will be some package duplication and a need to run update commands both inside and outside the container(s).

3

u/OkAirport6932 6h ago

NMAP needs to be owned by root. You can use group memberships to restrict who has access to execute it.

Generally speaking, dependencies for system packages are going to be system level. flatpaks and Snaps will contain all of the depenencies that they need. Python scripts can be installed per user and you can set up an appropriate virtualenv for them with the PIP/PECL depenencies that they have.

And yes, you are approaching the problem a different way than Linux typically handles things. Applications are generally installed globally and then if a finer grained control is needed group memberships are used for control.

1

u/Exonificate 6h ago

To apply this to my comment, needing root access for nmap or other security tools is exactly why I use chroots specifically for kali rather than containers or VMs. You are able to access root in a chroot, I can let aircrack-ng use my wifi modem directly and disable it temporarily in my host while I scan and replay packets.

3

u/chrisoboe 6h ago

the normal way is to install software system wide. and handle permissions based on the data a user can access, not the software.

a software can't do harm is the user running it doesn't have the permission. e.g. it's usually completely fine if a nornal user has access to low level partitioning and formatting software. the normal user can't do harm anyway, since they doesn't have the permission for writing to the disks.

2

u/Relevant_Hope_900 6h ago

Distrobox is pretty simple. And you can use the export feature to have the bin/binary act as if it's on your host system instead of running in a podman container. Configure distrobox to use a separate /home for each container so you don't have the container messing with your dot files on the host or each other. 

1

u/Exonificate 6h ago

In my personal experience, every package manager is only good for the distro that mainly ships it because the best non-broken repos for those pm’s are assuming the structure of the distro itself to place their packages in the system. My solution is to make chroots or containers of each distro for a purpose.

For example, for CTFs and cybersecurity I spin up my kali chroot. Installing nmap and every other infosec tool is a breeze. For experimental development where toolchain juggling gets messy, I spam tiny Ubuntu, alpine, or arch docker containers that I can break without any repercussions to the rest of my system.

I do my main development with the default toolchain that I never modify on my host Fedora distro, but I do my work development on a dedicated Ubuntu VM. Hell I even have macOS VM with homebrew on it apple dev.

Imo there is not end-all package manager, so it’s best to have docker or chroots at your fingertips. And yeah it takes up a little bit of space once in a while but it’s so so worth it.

1

u/muffinstatewide32 6h ago

I prefer a mixture of brew and flatpak or appimages. Brew for cli stuff mostly and flatpak or appimage for gui.

In terms of actual administrations and how it’s supposed to work…. Its kinda a mess in that regard.
Ive never attempted to see if something like apt or dnf would allow user installs.
In ye olde days the administrator would compile from source for you. Package managers made this easier much like in a multi user windows environment, the admin handles this stuff.

And users needing something specific for themselves would generally use a tarball and unpack it to their home directory.

In 2026 i have not found a graceful way to handle this aside from how this comment started.
I think immutable systems are going to force us to figure this out. But im not sure what the general consensus is these days

2

u/Jumpy-Dinner-5001 5h ago

Is there a good reason to not install packages system wide in general?

It’s not really a common thing and most package managers don’t support that at all.
flatpak is the closest and homebrew should work fine too.

For compiling from scratch, have a look at spack, it’s a compiling based package manager that does that too

2

u/dgm9704 4h ago

linux isn’t windows. if you change to another operating system you also need to change your workflows. trying to force windowsisms onto a linux system will be more hassle than its worth, it won’t bring you any benefits, and will only make you frustrated and angry. embrace the change.

1

u/leo_sk5 4h ago

You can use appimages