Linux: Installation directory of application installed only for current user

StackOverflow https://stackoverflow.com/questions/14389035

  •  16-01-2022
  •  | 
  •  

Вопрос

I have a Python application that is currently installed following Linux Filesystem Standard Hierarchy (FHS). It is installed in:

  • /usr/bin/ (executable)
  • /usr/lib/python2.x/site-packages/{appname}/ (Python libs)
  • /etc/{appname}/ (conf files)
  • /usr/share/man/ (manual files)

Now, it is desired that a non-root user installing this application could install it without root powers and that only this user could run the app. We thought the best would be to install the app in user home directory.
We already have a .{appname} directory in user home to keep per-user configuration files, as the app installed configuration files in /etc.
I think that using the .{appname} dir to keep all application files is not a good idea, as directories pre-appended with . only keeps configuration files. Probably I'll remove the .{appname} dir, as the entire application will be installed per-user now.

2 ideas:

  • Create a {appname} dir and create subdirs bin, etc, lib and share/man.
  • Replicate Linux FHS under home and create a {app-name} subdir under lib and etc
    • ~/bin/
    • ~/lib/{appname}
    • ~/share/man/
    • ~/etc/{appname}

Which one of these is more often used and more recommended? Pros and cons of each alternative are welcome. Maybe a third option?

I've seen people recommend /home/usr/bin and /home/usr/local/bin, but I don't understand the need to include the usr here as there is no need to differentiate between essential and non-essential binaries/libraries. I'd prefer to be minimalist.

Thanks in advance.

Это было полезно?

Решение

The first option is the most common. A third option is to create (or fill out) the structure under ~/.local/ (which reflects /usr) that is already used by a number of applications for share/.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top