1

Like virtualenv in python, Is there a way to create a custom environment inside the home folder ( atleast for installing apt packages ), and without requiring sudo rights, and also without assuming that any packages be installed already by the root ?

I have explored docker and even docker-rootless, but even docker-rootless still needs newuidmap and newgidmap to be installed in the system. Even if that can be installed, the bottleneck can be from the fact that the user must have atleast 65536 UIDs/GIDs per user.

Somewhere chroot was recommended, but apparently that too requires administrative privileges to setup.

I noticed that Flatpak has some features like this, but there are 2 issues with that too.

  1. It requires flatpak to be installed by the root
  2. It doesn't have most apt packages.

I ask this for 2 main reasons.

  1. To install apt packages in my home directory instead of root in my own laptop ( with sudo rights )
  2. To install packages that doesnt necessarily do anything that requires sudo rights, but still needs apt to install. apt download just doesn't cut it, as we have to manually deal with the dependencies and configuration etc.

Is there a reason why nothing like virtualenv was attempted for apt ?

  • Seems very similar to https://unix.stackexchange.com/questions/42567/how-to-install-program-locally-without-sudo-privileges. – user535733 Apr 21 '21 at 17:14

1 Answers1

1

You may download the package directly with apt, and extract the files with dpkg, but with most bigger programs, you have to manually adjust tons of config files to match the different environment.

apt download <apt package name>
dpkg -x <package file name> <destination directory>

For example:

apt download x11-apps
dpkg -x x11-apps_7.7+7_amd64.deb ./
paladin
  • 506
  • Like i mentioned apt download doesnt cut it due to the fact that i might have to do everything including configs myself. – Harish Ganesan Apr 21 '21 at 17:00
  • The only easy to use but crap solution is to use apt show snapd, which will create an entire virtual machine just to run you 1KiB app. If it's that what you want, you are free to go, but don't expect any help from any serious Linux admin. – paladin Apr 21 '21 at 17:07
  • to run apt download you must have run apt update. If not you still need root access for that – Jeff Saremi Sep 13 '23 at 14:34