The default package manager for mainstream Linux distros (deb/apt, yum/dnf, pacman, etc) do global-installation by default and require root. It seems better to install as user or group and not need root, because one would run less untrusted code as root (as Nix, Guix, Cargo, Pip, Gem, Cabal, Stack, CPAN).
To save space on shared systems, one could install packages to directory which is readable by users but writable by admins, but this doesn't have to be root, and it should still permit users to install their own packages.
Package that modify protected files like Grub or provide services would need to modify the root system, but everything else should be doable from user-side.
This question says that packages may assume they are installed to specific locations in the Filesystem Hierarchy, but I thought this could be fixed by setting $PATH
, $LD_LIBRARY_PATH
, and friends. And otherwise, why not just have a wrapper that runs the program in a chroot?
/
; why not install in$HOME
? – charmoniumQ Apr 06 '22 at 09:20Dir
andRootDir
configuration options allowing you to set the root of the installation to pretty much wherever - you just have to set up the directories and files that apt expects in that location. (You can even configure some specific directories, e.g.,apt -o Dir::State=$HOME/apt/state update
should work fine as a non-root user.) – muru Apr 06 '22 at 10:22