Point/Counterpoint - /opt vs. /usr/local

Should a sysadmin put additional software in /usr/local or /opt? Bill and Kyle argue the one true location for third-party software.
______________________

Kyle Rankin is a director of engineering operations in the San Francisco Bay Area, the author of a number of books including DevOps Troubleshooting and The Official Ubuntu Server Book, and is a columnist for Linux Journal.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

/opt or /usr/local

Jeffrey Moncrieff's picture

I usually put small type of applications in /usr/local like clients types applications and servers type applications in /opt. /opt could possible be a nfs or samba mount which makes disaster recovery more easier of that mount. Now having said that you would want to make sure that share was located on a system that has a redundant backups ie RAID.

What about /srv vs. /var/lib ?

Anonymous's picture

... and /home vs. /usr/home ? And /usr vs. /usr/local ?

An alternative view point just to mix it up.

Mike.Tiernan's picture

I agree with both Bill and Kyle in their discussion of /opt vs. /usr/local (if such a thing is allowed) but I have yet another take on it given to me by some of the brains I used to work with who had a keener grasp of the idea of multiple computers vs single standalones.

If I am running a system as a standalone machine (even if it is networked to others of it's ilk) but shares no common data/code then /opt is a symlink to /usr/local

However, if I have a set of systems that have locally unique files, they, as Kyle said, go in /usr/local but the packages/tools/files that I build in one place to make available to all the systems in my "cluster" (not cluster computing, just grouped) then all these files and things go into /opt which is a shared mount point as Bill discussed.

And, if you are really good, you'll have /opt for different flavors of systems, such as opt.x86_64, opt.i386, opt.sol9, opt.irix, etc. and they automount as needed.

A simplistic example of the difference would be something like this:
Say you have four Linux hosts, one in Buffalo, one in Boston, and two in the central office in Dallas. The weather data from each of the sites is automatically stored in a data file in /usr/local because two of the three sites don't need to know about the data for the remotes. The program which reads this data, is the same binary and is found in /opt on each machine. Each of the systems can generate the local data trending information and store it in /usr/local but none of the systems can write to /opt.

Yes, it's a contrived example but I hope it illustrates the point reasonably well.

Does the use of a "formal" packaging system such as RPM or DEB change this? No, it just makes it different.

So, in closing, in my opinion, it's a draw!

(If any sysadmin counts the six extra characters in /usr/local as an impediment to their job, they should be hanging it up right now. I question if any decent sysadmin can even measure the difference in time between typing /opt and typing /usr/local it is so small.)

Thanks for all the conversations!

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix