Where on file system to place command-line tools from GitHub?
Where on the file system do you place command-line tools that you install manually (but that require no compilation) from places like GitHub? For example, things like https://github.com/rg3/youtube-dl/ and https://github.com/sivel/speedtest-cli.
I've just been putting them in my home directory then updating PATH env variable manually to include the subdirectory containing the executables, for each of those projects. What's a cleaner way to do this? Is there a location outside of /home where I could be placing these? I put things in /usr/local/sbin but those are just standalone scripts, not whole directories. And sbin is for administrative things and the kinds of tools I'm talking about aren't really for administration. There's also /opt, but that seems to be the location where tools that were installed by .deb packages put themselves (e.g. Vagrant). What are some options I have for where to put these things? And is there any way around having to manually update PATH to include each of these tools separately? |
The usual place is /usr/local.
The contents of /usr/local is usually a etc, bin, lib,... as a mirror of the systems construct. Personally, I have extended it slightly by putting a package_name.version in /usr/local which allows me to put multiple versions, then (as admin) I can create a symbolic link package_name to point to whichever is the current version. In bin I create symbolic links to the executables by with the structure "binname ../package_name/bin/executable", so that if I switch versions, everything gets switched. The same goes for the /usr/local/lib. Sometimes calls for a bit of cleanup in the /usr/local/bin as executable names are dropped or changed, but it does allow me to keep an older version around (just in case), the current version, and a new test version. Though to use the new/old version I have to put its entry in my path before putting /usr/local/bin. The advantage of keeping these packages separated from the system is to avoid potential collisions... and allows a separate backup to be made easily. When I was at work, we kept the /usr/local directory on a separate partition, so that even if the OS is completely replaced, the /usr/local filesystem could just be mounted normally, and all those packages would not have to be reinstalled. |
For simple stuff like youtube-dl I am quite happy using $HOME/bin.
|
All times are GMT -5. The time now is 11:35 AM. |