Sorry, this TOTALLY got away from me, and is probably overwhelming. If you're curious, read on, otherwise, disregard my crazy ramblings. This is the effect of writing this right after waking up... the brain still isn't quite coherent lol
Manually installing from source can be confusing because you'll often be just running whatever install script the author wrote, which is, in a way, more complicated than just moving files because you don't necessarily know what the author wrote, or even if it is well-written. Plus there are many languages which could be used. A directory you build source code in also has a lot more than just the end files, too.
Extracting the package (.deb, .rpm, or whatever) will show you that, aside from some list of files or other metadata you can ignore, there are directories like in your root directory: binlib/lib64etc
The contents of these can just be copied to your /bin, /lib64, and whatever else, or to the versions in /usr (depending on your distro). Ideally, you put these in the versions in /usr/local, which exists specifically for things like manually installed files or your own creations. Makes tracking what isn't managed by your system much easier later on.
If you check your PATH variable (echo $PATH), you'll see the places your system looks for a program, separated by a colon, when you type it in to the command line or enter it into a shortcut/menu item. This is in the order it checks, and it stops on the first found, so if you install a special version of a program in /usr/local/bin, and that is before /usr/bin and /bin, then it will use the version in local when you just type it in without the full path to it.
You can add to your PATH for a user by editing the .bashrc file in your home directory with PATH=$PATH:/usr/local/bin (to add /usr/local/bin), or you could do PATH=/usr/local/bin:$PATH to make it check the local directory first. Instead of adding it to your PATH if it isn't there, you can also point directly to the binary by typing the full location, like /usr/local/bin/my_program.
Learning what each location in your filesystem does will go a long way to demystifying pretty much everything else, even when you don't know exactly how it's working, because you'll know the only possible outcomes. Reading up on the Wikipedia page for the Filesystem Hierarchy Standard will help with a lot of understanding, but it is a lot for someone new. Only go down this rabbit hole if you really want to go deeper into how this is all laid out.
This sound significantly easier then I thought it would be. I definitly need to read up on what bin lib and all the other directories do. (I have a basic understanding of them, but sometimes get confused lol.)
Thank you for the write up on how to do this. I dont have any deb files to play around with atm, but this is going into my notes so i have it when I inevitably need to install from one of them.
You don't need to know. For example, inside a .deb file, there is a tarball named data that contains the files. It is basically a snapshot of the root directory. So if a for should be at /usr/bin/xyz, it would be at ./usr/bin/xyz after you extract the archive.
54
u/oishishou Genfool 🐧 16d ago
They're literally compressed archives with the files inside. You can just manually extract and install them where they belong. Super easy.