By default some applications install into /usr/local/bin
. But if I change user, will that user be able to access this application? I read somewhere here (another question) that I should use /opt
. But binaries that by default go into /usr/local/bin
? There's no /opt/bin
?

- 14,585

- 10,347
-
possible duplicate of What is the best place to install user apps? – Jorge Castro Oct 13 '11 at 15:24
3 Answers
Usually you should not have to try to install anything by hand. In almost all cases you will find a .deb package. If there isn't one, google for suggestions (like how to install Oracle JDK in Ubuntu). If this is your own software, check out the Ubuntu Packaging Guide for help on how to properly put stuff into Ubuntu.
If you must do it anyway, put the binary in /opt/myapp
and link the executable with:
ln -s /opt/myapp/myappbinary /usr/local/bin/myappbinary
If you want to know more on the topic, type man hier
in a terminal. The difference between /usr/bin
and /usr/local/bin
is explained there. In any case, both paths are in the $PATH
environment variable. That means any binary you put there will be executable by anyone just by giving the name of the binary (and not the full path). So using the above example you can run your program with myappbinary
instead of having to give the full path /opt/myapp/myappbinary
.

- 14,585

- 10,546
-
2What is the purpose of putting it in /opt, especially if you are just going to symlink it into /usr/local anyhow? – psusi Oct 13 '11 at 17:13
-
If I want all users of the system to be able to use the app, I should symlink into /usr/bin instead of /usr/local/bin? – Jiew Meng Oct 14 '11 at 05:44
-
5@jiewmeng If you look at
man hier
you will see everything explained there. Including the difference between /usr/bin and /usr/local/bin. In short: Don't symlink anything to /usr/bin/.@psusi The reason is to keep your filesystem clean. if you ever reinstall your computer (or move to a different machine/harddrive) the only directories you need to look at should be /home, /etc and /opt.
And let me repeat once more: Usually you never want to do anything outside your $HOME except for maybe editing config-files in /etc.
– mniess Nov 03 '11 at 22:19
/usr
is world readable, so no, there will be no problem with other users being able to run the program. /usr/local
is where applications that you compile from source code yourself go. Programs installed through the package manager go elsewhere. I have never seen any purpose to /opt
, and I believe it is just a carry over from the old AT&T Sys V days back in the '80s.

- 14,585

- 37,551
-
whats the diff between /usr/local/bin and /usr/bin? If I want all users to be able to access the app, do I put it in /usr/bin? – Jiew Meng Oct 14 '11 at 05:45
-
@jiewmeng, once again, the local version is for programs that you compile from source yourself, instead of installing through the package manager. It has nothing to do with users and access. – psusi Oct 14 '11 at 13:43
Depending on the linux-flavour, the preferred place to install something by hand might vary. If you do it by hand, do what the README suggests.
If you create a new user, and your old users hadn't to do anything to access the new program, the new users will not, too.
However, you're free to create /opt/bin and include it into the path, but why should you? Or even /flip/flop/funky/bin. Or link from somewhere to a directory, which is already included in the PATH.

- 6,507