You are not logged in.

#1 2008-10-02 10:24:46

yossarianuk
Member
Registered: 2007-05-02
Posts: 103

How do I add /usr/local/bin to path

Hi.

I have installed arch linux on a server.

It seems really very good - manged to install latest snort-inline easily...

However (and this is really a completely NOOB question)

- how do I add /usr/local/bin to the default (root) path ?

I have tried to add

PATH=/usr/local/bin

to /etc/enviornment

But it did not show up when using the - env command (after re-logging in)

I know that I could sym link to /usr/bin but i would like to know.

Any help would be good

Cheers

Last edited by yossarianuk (2008-10-02 10:31:21)

Offline

#2 2008-10-02 10:46:16

wonder
Developer
From: Bucharest, Romania
Registered: 2006-07-05
Posts: 5,937
Website

Re: How do I add /usr/local/bin to path

if you want only to specific user edit ~/.bash_profile or ~/.bashrc and put there

export PATH=$PATH:/usr/local/bin

if you want for all users edit /etc/profile and scroll down until you see something like

# Set our default path
PATH="/bin:/usr/bin:/sbin:/usr/sbin"
export PATH

append to the end /usr/local/bin. it will be

PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin"

Last edited by wonder (2008-10-02 10:46:57)


Give what you have. To someone, it may be better than you dare to think.

Offline

#3 2008-10-02 10:50:17

yossarianuk
Member
Registered: 2007-05-02
Posts: 103

Re: How do I add /usr/local/bin to path

Thanks - was just about to reply to the thread  - i used

PATH=$PATH:/usr/local/bin in /root/bash_profile

Cheers

Offline

#4 2008-10-02 12:19:40

Surgat_
Member
Registered: 2007-08-08
Posts: 317

Re: How do I add /usr/local/bin to path

That way you will only have /usr/local/bin on root's PATH. If you want to use it also with other users you will have to add it also to each one's ~/.bash_profile, or use the second option that wonder wrote above.

Offline

#5 2008-10-02 14:39:45

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,000

Re: How do I add /usr/local/bin to path

wonder wrote:

if you want for all users edit /etc/profile and scroll down until you see something like

# Set our default path
PATH="/bin:/usr/bin:/sbin:/usr/sbin"
export PATH

append to the end /usr/local/bin. it will be

PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin"

Don't do that. Make a file in profile.d and a+x it instead.
eg:

echo "#!/bin/bash\nexport PATH=$PATH:/usr/local/bin" > /etc/profile.d/custom.sh
chmod a+x /etc/profile.d/custom.sh

That way pacman can update /etc/profile as needed, without you having to deal with a .pacnew


Evil #archlinux@freenode channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#6 2008-10-02 15:18:15

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: How do I add /usr/local/bin to path

@Mr Elendig: +1

Offline

#7 2008-10-02 15:23:47

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,172

Re: How do I add /usr/local/bin to path

Put it in /etc/profile or ~/.bashrc.
Merging .pacnews is for sissies.
tongue

Offline

#8 2008-10-02 22:58:50

scrawler
Member
Registered: 2005-06-07
Posts: 315

Re: How do I add /usr/local/bin to path

isn't using /usr/local/bin frowned upon?

Offline

#9 2008-10-02 23:22:42

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: How do I add /usr/local/bin to path

That's where I store my scripts...
I just added it to my path via .bashrc

Is it really frowned upon ? Why is that ?

Last edited by moljac024 (2008-10-02 23:23:04)


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#10 2008-10-03 01:25:31

scrawler
Member
Registered: 2005-06-07
Posts: 315

Re: How do I add /usr/local/bin to path

I'm probably wrong, but it's not in my $PATH by default, and the PKGBUILD wiki page says

Good thing is, if you already managed to compile the package manually, you basically only need to list the commands you used here, and things should work out just fine. Since many packages like to install their files relative to the /usr/local directory, but Arch Linux prefers using just /usr, you probably want to supply a parameter to the configure script or the make command to take care of this. The prototype PKGBUILD serves as an example for that. It might work differently, though; Again, your mileage may vary.

the bit I bolded may have contributed to a misconception on my part.

Offline

#11 2008-10-03 01:57:45

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: How do I add /usr/local/bin to path

There's a place for all three of /usr/bin, /usr/local/bin, and ~/bin --- even on Arch.

If you download package whizbang-1.2.3 from some non-Arch site, its installer will often by default try to install its files into the /usr/local hierarchy. When making a PKGBUILD, you want to tell it instead to install into $pkgdir/usr, so that when you install the resulting pkg file with pacman, it goes into the /usr hierarchy. That's what the wiki page is saying: pacman-managed stuff goes into the /usr hierarchy.

/usr/local/* is for files you want to install systemwide without making a PKGBUILD. Your own scripts are a great example. Also you might want to install some compiled files that way, if making a PKGBUILD isn't worth it or you don't have the time to write (*and maintain!*) one.

~/bin is for scripts (could be compiled files too) that you want to only be available to that specific user.

Offline

Board footer

Powered by FluxBB