Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do you generally proceed for your package installations on Linux, for packages that are not part of your distrib's repos?

On my side I am used to install in /opt. But since, I saw this doc on the Internet: http://www.pathname.com/fhs/. Now I am confused: apparently /usr/local would be also a possibility.

What is the difference between both? Any best practices to share?

Thanks

SirFabel

share|improve this question

migrated from stackoverflow.com Mar 21 '10 at 18:04

This question came from our site for professional and enthusiast programmers.

    
Holy war territory and not really a programming topic to boot. –  dmckee Mar 21 '10 at 17:37

6 Answers 6

  • Everything that has to be compiled & installed Unix-style and complies to FHS -> /usr/local
  • Everything else (e.g. a java web-application that comes with it's own applicationserver and loads of resources in a zip archive -> /opt
share|improve this answer

Just as additional interesting info: The original meaning of /usr/local is that if /usr is network-mounted (single /usr shared across multiple computers), /usr/local would be a separate filesystem local to the computer (partition on local disk).

And while on that topic, even if it's off-topic to the question: If there are multiple computers with different architectures, naturally there would be one /usr for each arch, but /usr/share would be yet another separate filesystem shared between architectures (hence 'share').

share|improve this answer
    
+1, this is very accurate. –  Ninefingers Mar 21 '10 at 17:39
2  
No... historically (yes, I was there!) /usr et al had the vendor-provided stuff, /usr/local was locally installed stuff (i.e., bash, gcc and other nice stuff). –  vonbrand Jan 15 '13 at 18:54

The way I do it is that if it requires a prefix to itself OR it's a binary package, I go for /opt (which is pretty much the Solaris way). If i'm compiling from source /usr/local is how I go.

share|improve this answer

I put everything in a private directory and then use GNU stow.

So, I'll install package X.ver to /BASE/stow/X.ver. GNU stow will then combine all the packages (with symlinks) into /BASE/bin, /BASE/lib, etc.

Conflicts and removing packages are much easier to deal with.

share|improve this answer
    
I've typically used /usr/local/stow/<packagename> as the home for stow "packages", and feel like it's a good practice - if someone else looks in /usr/local it makes it obvious what's going on and what system is maintaining the symlinks. –  Stephanie Jun 20 '12 at 22:51

Here is how I do interpret the FHS standard:

/usr/local is for locally built or locally installed files, whether packaged or not that somewhat become part of that instance of the Operating System.

/opt is a place to install "foreign" packages not part of the Operating System.

As long as you only use files on the single system where you build them, /usr/local is fine, and it is therefore the default base directory for the vast majority of open source software.

If you plan to redistribute your package, I would recommend using a custom base directory like /opt/myPackage.

share|improve this answer

Solaris used /opt a lot. Many modern Linux distros now expect packages in /usr/local/. The idea is the same - a place to put software that makes this machine do what it does, as opposed to the operating system. It's roughly analogous to "Program Files" on a Windows system.

Pick one and stick to it. It's easy enough to symlink /opt to /usr/local.

share|improve this answer
    
I like Lee's comment, nice way to think about the problem. It would feel a bit weird to me to have an /opt on a Debian machine, but that's probably just personal preference. –  Kyle Hodgson Mar 21 '10 at 17:31

Your Answer

 
discard

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