Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Safe to copy source built binaries to /usr/bin?

  1. #11
    Join Date
    Apr 2020
    Location
    where the work takes me
    Beans
    88
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Safe to copy source built binaries to /usr/bin?

    @TheFu Thanks for the detailed reply, I'll take a look into the book as I much prefer quickly thumbing through a book I can grab to having to search the interwebz every time I need a command.

    As for unix like systems, I think it's cool how they seem to have this really rich history which I have sometimes found helpful in understanding some conventions, like the X server - to a layman like me it seems confusing and ridiculous until you remember that unix was like a distributed system, so its like having the conventions of a distributed system, but its just all on my laptop.

  2. #12
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    20,223
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Safe to copy source built binaries to /usr/bin?

    Quote Originally Posted by jcdenton1995 View Post
    Hi there,

    There isn't a ~/bin on my system by default, I tried adding it but binaries stored in there can't be called using only their name. I'm sure I could fix that but I'm keen to try and keep things consolidated instead of spreading files around if I cam help it.

    Is it really bad practice to use /usr/bin? My other binaries I installed from the package manager are stored there.
    /usr/bin is for APT packaged managed programs on Debian/Ubuntu and APT-based systems. if you install a special version of some binary there then somehow the package manager decides to install a version too, then your version will be overwritten AND the package manager will think that file is under its management.

    You should get used to making directories that are common and needed when they are needed. ~/bin is one of those. Same for /usr/local/bin/.

    Don't confuse "users" with "admins". Users can only write to their HOME and /tmp/. Admins can write almost everywhere. Never forget, all Unix-like systems are multiuser even if you are the only human using the system. The OS knows there is a difference. Well, not really, but file permissions handle those differences. Don't screw up file permissions for programs.

    As for logging out and logging back in to see changes, that isn't strictly needed except to have the gui know things. Any terminal can be brought up and should see any new programs in a modified PATH. Every running shell will automatically see new files w/ execute permissions that is created in any directory already in the PATH.

    Managing a PATH is a day-3 skill in my beginner Linux classes. it isn't hard and MS-Windows uses the PATH EXACTLY the same way.

    conventions of a distributed system, but its just all on my laptop.
    Your laptop is still a Unix system whether you use it that way or not. Using network storage, running programs on other systems to be displayed locally, remotely logging into other systems are all built into Linux and have been since 1991.
    Last edited by TheFu; June 6th, 2020 at 10:24 PM.

  3. #13
    Join Date
    Apr 2020
    Location
    where the work takes me
    Beans
    88
    Distro
    Ubuntu 18.04 Bionic Beaver

    Re: Safe to copy source built binaries to /usr/bin?

    Quote Originally Posted by TheFu View Post
    /usr/bin is for APT packaged managed programs on Debian/Ubuntu and APT-based systems. if you install a special version of some binary there then somehow the package manager decides to install a version too, then your version will be overwritten AND the package manager will think that file is under its management.

    You should get used to making directories that are common and needed when they are needed. ~/bin is one of those. Same for /usr/local/bin/.
    Nice one thanks, that makes sense. I went ahead and made ~/bin and have moved a couple of source built binaries into it, one of them was actually put in /usr/bin/ by 'make' so I guess that goes to show that you cant always trust where files get dropped...
    Last edited by jcdenton1995; June 6th, 2020 at 10:53 PM.

  4. #14
    Join Date
    Aug 2013
    Beans
    4,266

    Re: Safe to copy source built binaries to /usr/bin?

    Quote Originally Posted by TheFu View Post
    As for logging out and logging back in to see changes, that isn't strictly needed except to have the gui know things..
    He needs to login and logout because ~/bin didn't exist last time he logged in, and .bashrc only gets run when logout and login again (though you can run source ~/.bashrc without logging out)

  5. #15
    Join Date
    Aug 2013
    Beans
    4,266

    Re: Safe to copy source built binaries to /usr/bin?

    Actually for my own set up I compile the software in ~/opt (I created the directory), then either symlink the binary to ~/bin or put a script in ~/bin to run the actual binary if some nonstandard environmental variables need to be set first. If install for system, then it gets installed to /usr/local

  6. #16
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    20,223
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Safe to copy source built binaries to /usr/bin?

    Most source build tools/makefiles have a way to set the "PREFiX" to /usr/local/ to prevent that issue. Projects that build packages for RPM and APT would probably default to /usr as the prefix, but Debian and Canonical don't just grab the latest versions of software for a release.

    That's why we often have 2 yr old versions of some packages even in fresh releases. if you need a newer version, use a trusted PPA for the software. Source code is probably the least best of the choices for installing compiled software.

    Using source means that you accept the responsibility to patch, build and install the newer versions on your system(s). That defeats the reasons to use a curated Ubuntu OS install. Sure, there are times when there isn't any choice and it has to be done. Those times should be limited and avoided when possible. Packages for scripted tools are a little less bad and less hassle to maintain, usually. Just depends on any dependencies for the package/software.

    My ~/bin/ is full of custom scripts that aren't systems related. All scripts start there and as they become "Production quality" and if they are safe for other users, then they would be moved to /usr/local/bin/. Scripts that are specific for admin tasks go into /usr/local/sbin/

    What directories should be used to hold is spelled out in the FHS. Most Unix systems follow this. There's a wikipedia page about those standards. Except that the Canonical Snap team doesn't seem to have ever read the FHS, unfortunately.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •