[SOLVED] What circumstances justify the installation of compiled software in "/usr"?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What circumstances justify the installation of compiled software in "/usr"?
I have to use custom versions of Python, Postgresql and Apache httpd. I have uninstalled them and I will compile them from source, it is a local machine and I am the only user.
I am wondering if due to the importance of the applications I should install them in /usr using /usr/lib64 and /var for the library and state folder.
Well for the programs that ship with Slackware (that you just want to use a different version of), I would recommend installing them into /usr/local or /opt/<package name> as per the Filesystem Hierarchy Standard. If you install those directly into /usr (where Pat installs them), they may overwrite the files that ship with your Slackware version and cause problems.
I'm not sure about PostgreSQL, but since that doesn't ship with Slackware, that might be okay to install into /usr (don't quote me on this), but I would still install it to /opt/postgresql (personal preference).
Also look at possibility to turn your custom compilation into Slackware package where you can later manage it with installpkg/removepkg. There is an utility called src2pkg which allows you to turn source tarball into Slackware package.
Personally I install libraries in /usr and everything else in /usr/local. This is to avoid the situation where programs will not find the libraries unless they are in /usr.
as wigry and GazL have pointed out, best strategy is to use package management, ideally by modifying the original SlackBuild scripts. No harm installing into /usr when under control of package management. When installing manually I heavily recommend using alternative locations just to keep an overview, be it /usr/local, /opt or anything else that taketh your fancy. If the chosen directory represents a separate file system, certain operations down the road become easier (eg. system-reinstall).
No circumstance justifies compiling from source.
The best practice is to use SlackBuilds and create packages, even ones that install in /usr/local or /opt or /home/$USER or whatever.
Even better practice is what SBo does and copy the SlackBuild script used in the documentation directories. That way you can always check how the package you have installed is compiled.
The only exceptions could be binary blobs like nvidia, virtualbox or skype.
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
A good rule of thumb is one that doesn't come back to haunt you -- I long ago learned that add-on software really should live in /usr/local and add-on applications really should live in /opt. The idea being to keep distribution software; i.e., that provided on installation media, be kept "pristine," un-fooled-around-with.
Why? Well, I partition disk drives so that /opt and /usr/local are mounted file systems (among others) and the system partition only contains that software provided on the installation media -- when an update arrives (such as Slackware 14.0 from Slackware 13.37), it is a simple task to do a clean install (after saving certain configuration files off to a separate partition) by simply choosing to format (or create a file system) on the system partition but not doing so on the "local" partitions thus everything in the local partitions remains in place (this is when you're doing setup and adding disk partitions to fstab). Here, "others" include /var/lib/mysql, /var/lib/pssql and /var/lib/virtual -- they remain in place.
I construct a "standard tree" in /usr/local; bin, etc, include, lib, lib64, man, sbin, share, src. This accomplishes two goals: no system files accidentally get overwritten and the "local" stuff is easy to find. When I'm building packages from SlackBuilds.org I modify the packagename.SlackBuild file (if necessary) to install in /usr/local, similarly, if I'm building something from source (with configure-make-make install) using src2pkg, I force src2pkg to install in /usr/local.
Slackware already includes /usr/local/bin on the system PATH environment and it's easy enough to make simple changes to a user .profile file for other needs.
Keeping "church and state" separate is just a good idea that will save trouble down the road, methinks.
I have to use custom versions of Python, Postgresql and Apache httpd. I have uninstalled them and I will compile them from source, it is a local machine and I am the only user.
I am wondering if due to the importance of the applications I should install them in /usr using /usr/lib64 and /var for the library and state folder.
I'd say that that's never a best practice.
Just build custom Slackware packages and use upgradepkg to swap to them. SlackBuilds for Python and Apache in /source. Change the names of the packages from "*-1.txz" to *-1[YOUR_INITIALS].txz" so that they're recognized as custom builds. SlackBuilds for Postgres and for Python 3 are on SBo.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.