2

I'm trying to install an app from tar.xz. It is portable, meaning I have only to unpack it to some directory and it should run from there as normal user. But where do I unpack it to?

Google recommends /opt but it is owned by root and I cannot write to it as normal user. If I create a subdirectory there as root and copy the files as root, the apps runs correctly only as root. When run as normal user, it cannot write its own config. Obviously.

So, where should I install it?

ETA The accepted answer in the linked (for some reason) question does not work for me. It suggest /opt which breaks the app due to permissions.

sigil
  • 479
  • 5
  • 12
  • 1
    Does this answer your question? [When installing user applications, where do "best practices" suggest they be located?](https://askubuntu.com/questions/1148/when-installing-user-applications-where-do-best-practices-suggest-they-be-loc) – Artur Meinild Nov 16 '22 at 12:03
  • 1
    From the duplicate, `~/opt/` or `~/bin/` would be good choices. But in the end you decide - and add to your `PATH`. – Artur Meinild Nov 16 '22 at 12:05
  • @ArturMeinild The accepted answer to use `/opt` does not work for me. I think I saw that one already. Comments there suggest to use my normal user home... Sounds funny but I guess I could go with that. Still funny. – sigil Nov 16 '22 at 12:14
  • This is because it isn't an exact science. You can put anything anywhere you want, as long as you're content with it (and have it in your `PATH`). Just because an answer is accepted doesn't mean it's the only true answer - just that it worked for the original poster. – Artur Meinild Nov 16 '22 at 12:15
  • There is another answer with 42 upvotes that suggest `/home/user/opt/` - why isn't that working for you? – Artur Meinild Nov 16 '22 at 12:24
  • Because it is a portable you don't install it. You just unpack it. If you are going to use more portables you can make a folder 'Portables' in your home directory. – Joepie Es Nov 16 '22 at 14:28

1 Answers1

2

Google recommends /opt but it is owned by root and I cannot write to it as normal user. If I create a subdirectory there as root and copy the files as root, the apps runs correctly only as root. When run as normal user, it cannot write its own config. Obviously.

No.

You install it in /opt using sudo and then change the owner of the directory of the app to your user. So if the software installs to mysoftware.v1

sudo chown $USER:$USER -r mysoftware.v1

and you can use this software and edit configuration.


Mind though that /opt is for installing software used globally (by more than one user) and it tends to use a script or service to connect to the software.

If this is intended for a single user you should install it in its own directory in your /home/$USER/ (and you could do ~/opt/mysoftware.v1/ (if you intend to install more) or ~/mysoftware.v1) and add the directory to your PATH if you need to start it from anywhere.

Rinzwind
  • 293,910
  • 41
  • 570
  • 710