user-installed binaries

Is there a default location in FreeBSD for user's installed binaries that are system-wide used? Something like /opt in Linux FS. Or have I simply to utilize ~/.local/bin? I see that /usr/local/bin is already populated with system bins and I don't want mix them. Thank you!
 
Is there a default location in FreeBSD for user's installed binaries that are system-wide used? Something like /opt in Linux FS. Or have I simply to utilize ~/.local/bin? I see that /usr/local/bin is already populated with system bins and I don't want mix them. Thank you!

I use $HOME/usr_$arch-$os/bin for the case that I'm on an NFS homedir.

/opt is where I put self-compiled larger packages meant for the whole machine.
 
Is there a default location in FreeBSD for user's installed binaries that are system-wide used?
These statements somewhat contradict themselves a bit. Normally a user doesn't have r/w access to system folders and it's also common practice to prevent anonymous access into home directories of random users. Sorry, bit of a lame comment from me, but still ;)

Something like /opt in Linux FS. Or have I simply to utilize ~/.local/bin? I see that /usr/local/bin is already populated with system bins and I don't want mix them.
If you know about /opt then why not use it? Solaris also heavily relied on /opt back in the days, so when I eventually switched to FreeBSD I just kept on doing so. Nothing wrong with that (and it also won't get in the way of any upgrades).

As for me.. it depends.. I heavily rely on /opt for any stuff which I add myself but still want to access on the whole system (like my Minecraft server, Circle MUD, some Git repositories, etc.) and everything else goes neatly into ~/bin or ~/develop (when some of my scripts aren't yet production ready).
 
To be more correct it's more general executables, which mostly are but doesn't have to be neccessarily binaries ([shell] scripts also work that way.)
What an executable is depends on four things:
  1. Everything within the terminal (shell, CLI) is used as the very first or only argument is seen by the shell as it should be executed. If 2, 3 and 4 are also given, the shell let the system executes it.
  2. It must be of some kind capable (compatible) to be executed in that shell and/or on that system/machine (binary, sh script,...)
  3. It's mode needs be set as executable with chmod(1)
  4. The shell needs to know where to find it. This is done either by using it by its complete path-name (e.g. ./myprog if you are in the dir where it lives), or it can be used without the pathname when it's in one of the directories the shell searches for executables in, defined as $PATH. By default those places are:
  • /bin/, /sbin/, /usr/bin/ and /usr/sbin/ for system's executables.
  • /usr/local/bin/, /usr/local/sbin/ for additional (not system's but anyway systemwide [for all users]) available executables. On a multiuser system one of those would be the place root places a copy of it.
  • $HOME/bin for all executables of the certain user. If only this user uses that executable, or you have a single user system, that would be the place to put it.
If you have a system with more than one user, want to make it available for all users, but don't want to put in any of /usr/local/..., you can place it where you think it's placed best, and then either
place a link with ln(1) into /usr/local/bin/ or /usr/local/sbin/ pointing at that file.
Or - not actually recommended to be first choice, but for some usage cases worth a thought, like when you have several or many of such executables on your system - place those into a directory of their own, and add this directory's location to the shell's $PATH. But this should be thought out pretty well, because you better know for sure what files you edit, and why. And you need to respect every $PATH for each shell available on your system (sh, csh, bash,...)
 
These statements somewhat contradict themselves a bit. Normally a user doesn't have r/w access to system folders and it's also common practice to prevent anonymous access into home directories of random users. Sorry, bit of a lame comment from me, but still ;)

If you know about /opt then why not use it? Solaris also heavily relied on /opt back in the days, so when I eventually switched to FreeBSD I just kept on doing so. Nothing wrong with that (and it also won't get in the way of any upgrades).

As for me.. it depends.. I heavily rely on /opt for any stuff which I add myself but still want to access on the whole system (like my Minecraft server, Circle MUD, some Git repositories, etc.) and everything else goes neatly into ~/bin or ~/develop (when some of my scripts aren't yet production ready).

Exactly, the problem was to make my homedir accessible for system-wide bin. Probably I'll follow the tip and create /opt.

Thank you everyone for the exhaustive answers!
 
Back
Top