> What’s the structure behind: usr/, bin/ etc/ lib/ and moving those to usr/local
A brief resume of the filesystem structure purposes is documented in "man hier" in any non stripped down linux (or online).
When you compile source code to binary format, there is a default PREFIX (i.e. /usr). So libraries will be installed to /usr/lib and binaries to /usr/bin...
Build systems, let you change such PREFIX, so you can build a program telling it to live under /usr/local, or any other root directory like /opt/myprog-version...
Then. if you build another program, that depends on the libraries of the previous program, you may need to tell where to locate such libraries if they are not in the default place, each program build flags may vary, but for example in ruby you can pass it to ./configure --with-openssl-dir=/opt/myopenssl-X.Y
For a description of the directories, see: https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
Note that these directories do not actually have many hard and fast rules... while you can't change /proc, you can argue all you like over whether something goes in /bin or /sbin, or argue whether it should go in /usr. There are a ton of differences in the details.
https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-AMD6...
Those are good places to refer to when unsure.
Distros mostly keep to this, but they implement their own details and you should look into each distribution to know exactly what goes on in any particular one.
For user applications the XDG Base Directory specification is also useful https://specifications.freedesktop.org/basedir-spec/basedir-...
The links lead directly into the POSIX documents, which can be quite handy when you write shell scripts, because there you can read which options should be the same on every POSIX compliant OS.
It's insecure and it's very prone to error on Linux. There's almost always a better way (and anyone who says differently is probably trying to sell something to someone.)