Why install to /usr/local reddit / BSD ---------------------------------------------------------------------- bluecliff92 · 2021-03-14 20:58 ive read FreeBSD installs packages to /usr/local but why ? Im GNU/Linux user and i understand it this way: /usr/ For packages installed by your systems package manager, for exame binaries in /usr/bin/ /usr/local/ For packages u install from somewhere else Is that not correct ? ---------------------------------------------------------------------- indienick · 2021-03-14 21:06 As I understand it (I flip between several BSDs and Linux, so I may be misremembering the odd detail), /bin is for whatever the system needs to boot. /usr/bin is for all other executables provided by the operating system. /usr/local/bin is for third party software, or anything that isn't a part of the base install. ---------------------------------------------------------------------- dudinax · 2021-03-14 21:13 I don't think directory conventions are consistent across various Unixes. ---------------------------------------------------------------------- Tireseas · 2021-03-14 21:46 Which makes sense given linux distros really have no concept of a "base" that's separate from the addon packages most of the time. ---------------------------------------------------------------------- losthalo7 · 2021-03-14 21:58 They're definitely not. NetBSD for example reserves /usr/local completely for the system owner's use (compilations from source, etc.). Pkgsrc lives under /usr/pkgsrc and installed Pkgsrc files live under /usr/pkg. The other BSDs do things differently. ---------------------------------------------------------------------- [deleted] · 2021-03-14 22:24 [deleted] ---------------------------------------------------------------------- Whoa_throwaway · 2021-03-14 22:24 linux is a kernel with tools around it. BSD is an os tht the kernel and user world work together. Anything that the local system administrator installs is stored in /usr/local (done typically with the ports system) Typically you should be able to copy all of /usr/local from 1 machine at an OS level to another and it would work. FreeBSD is very strict about their system hierarchy. you will know where things always (should be) are. in linux they may be in /usr/bin, they maybe in /usr/local/bin, they maybe in /usr/sbin, they could be in /opt/ in FBSD you'll always know where it is. https://www.freebsd.org/cgi/man.cgi?hier(7) ---------------------------------------------------------------------- ranadoo31 · 2021-03-14 22:42 `man hier` ---------------------------------------------------------------------- nielskob · 2021-03-14 23:22 You have base and you have 3rd-party packages. FreeBSD clearly differentiated between them. If it is in /usr/local/ it comes from a third party package. That can be helpful when you have stuff that can come from base or from a 3rdparty-package. Iirc openssl can be used from base or from a package. Then there is /bin and /usr/bin. In the past when you had small drives you might have on /bin everything that is really needed as a base for booting and running a very basic system. While the stuff on /usr/bin might reside on another partition. I recommend reading the man page of hier(7) on FreeBSD. Linux has file system hierarchy is a mess because it differs between distributions. ---------------------------------------------------------------------- AbsolutelyLudicrous · 2021-03-14 23:25 `man hier` :) --- A long time ago, MIT had a PDP-11 with two hard drives. One was for the operating system (`/`), the other was for users' personal files (`/usr`). While developing the next version of Unix, the root disk started running alarmingly low on space, so some programs were moved to the `/usr` drive. Eventually hard drives got big enough to store both `/` and `/usr`, but the two remained separate for historical reasons. By this point, users' personal files were stored in `/home` and `/usr` had been retroactively made an acronym for Unix System Resources. Eventually somebody got it in their head that programs provided by the operating system and programs installed locally should be separate, so `/usr/local` was created. Different OSes have different ideas of what software an OS ought to provide and what a user should have to install themself. * On FreeBSD, packages are *not* part of the core OS, and are installed to `/usr/local`. This sometimes leads to conflicts with unpackaged software that also wants to install to `/usr/local` * On NetBSD, packages are *not* part of the core OS, and are installed to `/usr/pkg` by default, or to whatever you set PREFIX to if you're building packages from source. `/usr/local` is reserved for unpackaged software. * On Linux, the OS is managed entirely through the package manager, and `/usr/local` is reserved for unpackaged software. Most modern Linux no longer makes a distinction between `/` and `/usr` - `/(s)bin` and `/lib*` are simply symbolic links to their counterparts in `/usr`. `/usr/local` still exists for unpackaged software. * On Plan9, `/usr` is actually the user's home directory. Also, `/sbin` doesn't exist and `$PATH` isn't a thing. Plan9 is very neat, I would recommend trying it out on a spare Raspberry Pi if you have one. There's also the strange case of `/opt`, which is for optional software - even though that's also what `/usr/local` is for. Java and Chrome install to `/opt`, sometimes; sometimes they don't. I delete that directory on my boxes. ---------------------------------------------------------------------- flatland_spider · 2021-03-15 05:32 NFS mounts also come into play when talking about the evolution of the directory tree structure. Now, we dump everything on the local server, but at one point, it was common for parts of the tree to live on NFS servers in order to save disk space. I don't remember which parts were commonly read-only NFS mounts, but I think it was `/usr`, minus `/usr/home` which would be a read-write NFS mount. `/usr/local` was the location for local software and modifications. My understanding of `/opt` is that it's used for software which bundles it's own dependencies rather then relying on the system packages. ---------------------------------------------------------------------- [deleted] · 2021-03-15 07:00 > Linux has file system hierarchy is a mess because it differs between distributions. Not really; most (sane) distros follow the [FHS](https://refspecs.linuxfoundation.org/fhs.shtml). ---------------------------------------------------------------------- astrange · 2021-03-15 11:44 Though, these are actually post-hoc justifications. There's no actual reason to have /bin and /usr/bin and these weren't the reasons it was done in the original UNIXes. They just happened to do it, and BSD copied it, and wrote the reasons later. ---------------------------------------------------------------------- scriptmonkey420 · 2021-03-15 12:03 I know its probably wrong, but I always used /opt/ for all non-package manager installs. ---------------------------------------------------------------------- ctisred · 2021-03-15 13:06 >retroactively made an acronym for Unix System Resources. Do you have a source for anyone actually calling /usr this at the time (e.g. late 80s/early 90s)? I have only ever heard this as a recent backronym by people who don't know any better.. ---------------------------------------------------------------------- teksimian · 2021-03-15 13:19 but Linux doesn't even do that. all configuration is in /etc which quickly becomes a huge mess ---------------------------------------------------------------------- Pretty_Boy_Bagel · 2021-03-15 16:46 >I always used /opt/ That's the old, old directory that most of us old-timers used back in the day. In fact I remember having to adjust to using /usr/local instead of /opt. I wouldn't be surprised if Tivoli installation still defaults to /opt. ---------------------------------------------------------------------- Pretty_Boy_Bagel · 2021-03-15 16:49 > Linux ~~has file system hierarchy~~ is a mess ~~because it differs~~ between distributions. FTFY. ---------------------------------------------------------------------- 7yearlurkernowposter · 2021-03-15 18:16 The nice thing about this is you can just do a rm -rf /usr/local and you are back to stock. Going through man page for hier(7) is the full answer. ---------------------------------------------------------------------- jwbowen · 2021-03-15 19:15 At least on AIX it does (along with most other add on software). ---------------------------------------------------------------------- Pretty_Boy_Bagel · 2021-03-15 19:21 Yeah, on AIX, that's no surprise that /opt is still used. Funny thing is AIX is one *nix I have the least experience with and it's still around (I think I had an account on an AIX machine when I was in college). All my big Solaris, Dec/True64 and Irix systems are gone. ---------------------------------------------------------------------- jwbowen · 2021-03-15 20:23 HP-UX hung around for a while. I do mourn the demise of Sun. I'd love to still see them alive and kicking. ---------------------------------------------------------------------- Pretty_Boy_Bagel · 2021-03-15 21:03 Used to have a couple Sun Fire servers back in 2001. Then HP tried to woo us to switch to HP-UX. ---------------------------------------------------------------------- losthalo7 · 2021-03-15 22:51 Not every *nix posting has to have an obligatory "rm -rf" gotcha comment. ;-) ---------------------------------------------------------------------- AbsolutelyLudicrous · 2021-03-16 16:26 Bingo! IIRC some versions of `hier` specify that `/` should be a local mount consisting of software needed to boot the system and for emergency recovery, and `/usr` should be an NFS mount containing software installed on the entire computer network. Thanks for the clarification on `/opt` - that actually makes a lot of sense. ---------------------------------------------------------------------- Nx0Sec · 2021-03-22 03:47 I also use /opt for all my non pkgmgr apps.. it's just the most optimum place to put them.. I'll see myself out ---------------------------------------------------------------------- grahamperrin · 2022-02-23 22:46 FreeBSD bug [261349 – Modernise hier(7)](https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261349)