Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

By default some applications install into /usr/local/bin, but if I change users 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 goes into /usr/local/bin? theres no /opt/bin?

share|improve this question
    
possible duplicate of What is the best place to install user apps? –  Jorge Castro Oct 13 '11 at 15:24

3 Answers 3

up vote 7 down vote accepted

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

share|improve this answer
    
What 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 5:44
2  
@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 3 '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 go that you compile from source code yourself. Programs installed through the package manager go elsewhere. I have never seen any purpose to /opt, and believe it is just a carry over from the old AT&T Sys V days back in the '80s.

share|improve this answer
    
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 5: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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.