24

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?

Jiew Meng
  • 10,677

3 Answers3

27

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.

mniess
  • 10,904
10

/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.

psusi
  • 38,031
0

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.

user unknown
  • 6,892