Where to install software and executables for all users

Solution 1:

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.

Solution 2:

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