LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-01-2005, 10:40 PM   #1
acummings
Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 615

Rep: Reputation: 50
local versus /usr/bin why, howto (Perl)


Hi,

Just to compare notes (when learning, don't you sometimes want to compare your methods against how others do it. I do.)

How much is

/usr/bin/local

to be used. and, what for?

I ask because I'm contemplating compiling and installing Perl 5.8.6 into /usr/local/bin

My experience has reached this point due to sufficient conflicts experienced on various distros in the past.

Such conflicts arose from what I needed to do with Perl and how I formerly attempted to achieve that end.

For example, if use the cpan to install additional modules onto the /usr/bin/perl can sometimes be problematic evidently due to /usr/bin/perl usually is a distro specific Perl which often may have somewhat differences than the cpan perl compiled from source.

Is it common practice to not disturb the /usr/bin/perl (it's needed for a lot of a distro's system maintenance) AND to also have Perl the way that I want with the cpan modules that I want by compiling/installing the Perl from sources, install into /usr/local/bin and use corresponding shebang line in my scripts.

The compile/install of perl I've done it three times already. It always works. Except on a Suse I first had to install gcc and another development thing and then compile/install.

it's just that I don't know what is a common practice (how others commonly deal with the issues that I've expressed herein). It seems weird to me to need two Perls but maybe it's the way to go due to what I need?

Thanks. Alan.
 
Old 03-01-2005, 10:45 PM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Most distributions don't put anything in /usr/local. I always install anything that I'm installing outside of the distibutions package management system in /usr/local. You want to be careful you don't break dependancies by replacing a distribution provided library/program.

In the few cases I've seen where a distibution did use /usr/local as the prefix for somethings I just pick another place like /opt/local or something like that.
 
Old 03-01-2005, 10:53 PM   #3
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Ok... let me be a little more specific...

When I compile/install things myself outside of my distribution provided package management tool I use /usr/local as the prefix for the install. Libraries go in /usr/local/lib, includes in /usr/local/include, binaries in /usr/local/bin, docs in /usr/local/docs, ect. ect.

If you want to make sure you use the stuff in /usr/local/bin by default then simply put in in your PATH before /usr/bin.
 
Old 03-01-2005, 11:02 PM   #4
95se
Member
 
Registered: Apr 2002
Location: Windsor, ON, CA
Distribution: Ubuntu
Posts: 740

Rep: Reputation: 32
/usr/local does actually serve a purpose. /usr/local is supposed to be used for the local drive. It doesn't really matter to many people on this site since they use their linux boxes as PCs, but many Unix systems actually serve terminals. the local drive of the terminal (if it has one) is usually mounted at /usr/local
 
Old 03-01-2005, 11:16 PM   #5
acummings
Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 615

Original Poster
Rep: Reputation: 50
Thanks jtshaw and 95se.

So, from what's been said, it appears that I had possibly messed up a dependency (or similar ie caused a problem) by attempting to customize (use the cpan on) /usr/bin/perl

Since I want to use the cpan lots in order for adding modules onto my perl then it appears best to not attempt modification of /usr/bin/perl but instead to compile/install perl from the cpan source code do so into /usr/local/bin/perl and then when i use the cpan to do so on this /usr/local/bin/perl and not mess with the other perl at /usr/bin/perl

And it appears that what I've shared herein is commonly accepted method when the need as you say requires something that is not distro specific (the cpan is not distro specific) the cpan is for perl but it might conflict with dependencies if used on a distro specific perl at /usr/bin/perl

Alan.
 
Old 03-02-2005, 01:09 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Because a distro won't touch /usr/local, it even makes sense to install this hierarchy in it's own partition. This would allow you to keep programs and libraries you installed from tarballs yourself even if you decide to reformat and re-install a new distro.

I do wonder if you want /usr/bin to precede /usr/local/bin in your $PATH variable, just in case that the distro's version needs to run by default.

According to the Filesystem Hierarchy Standard, "the /usr/local hierarchy is for use by the system administrator when installing software locally." I'm not certain what they mean by locally however, because two lines later it states "It may be used for programs and data that are shareable amongst a group of hosts, but not found in /usr." Also "locally installed software must be placed within /usr/local rather than /usr unless it is being installed to replace or upgrade software in /usr."
Since you said you want to retain the distro's version of perl, you are not upgrading or replacing, to /usr/local is where it needs to go.
However, I'm still not certain what the standard means by "locally installed" since they state that it may be shared by a number of hosts.

Last edited by jschiwal; 03-02-2005 at 01:11 AM.
 
Old 03-02-2005, 01:14 AM   #7
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
I know it is not uncommon to have /usr/local be an nfs mount to a local server containing applications and libraries you want everyone to be able to use. I have seen that setup in several offices I have worked in. In those cases I always put my own stuff in /opt/local instead of /usr/local.

As for the path issue, if you don't change the path so that /usr/local/bin comes first that be aware any programs that exist in both will run the distibutions version and not your own. It should be reasonable to change your users path order, but I wouldn't neccesarily change the path order for the default profile.

Oh ya... be careful about leaving /usr/local around after a distribution change and expecting it to work. Just because something's prefix is /usr/local doesn't mean it won't end up linking itself to a library in /usr/lib. Always beware of the fact that anything you compile yourself might have to be re-built if you upgrade/change your distibution around it as it might be dependant on things that no longer exists.

Last edited by jtshaw; 03-02-2005 at 01:16 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when starting up snort: bash:!/bin/sh/usr/local/bin/snort :Eent not found cynthia_thomas Linux - Software 1 11-11-2005 02:59 PM
Installing .bin-files, leave the file in /usr/local/bin/ ? lagu2653 Linux - Software 1 11-08-2005 08:30 PM
cant modify /usr/local/bin folder surgey Linux - Newbie 4 05-10-2005 05:52 PM
path in services wrong for clamav updated frm 0.75 to 0.80 usr/bin vs usr/local/bin Emmanuel_uk Linux - Newbie 3 04-22-2005 01:02 AM
/usr/local/bin pilerock Linux - Newbie 2 01-19-2002 11:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration