LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-15-2014, 11:41 AM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 709

Rep: Reputation: Disabled
Access program installed by root from source by a regular user


As the root user, I just installed Git On Centos 6.4 by following http://www.howtoforge.com/how-to-ins...sion-on-centos

Code:
cd /usr/src
#wget https://www.kernel.org/pub/software/scm/git/git-2.0.1.tar.gz
#tar xzf git-2.0.1.tar.gz
wget https://www.kernel.org/pub/software/scm/git/git-2.1.3.tar.gz
tar xzf git-2.1.3.tar.gz

#cd git-2.0.1
cd git-2.1.3
make prefix=/usr/local/git all
make prefix=/usr/local/git install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
source /etc/bashrc
It seemed to work.
Code:
[root@devserver ~]# git --version
git version 2.1.3
But then I return as a regular user, and it doesn't exist.
Code:
[root@devserver ~]# exit
logout
[Michael@devserver ~]$ git --version
-bash: /usr/bin/git: No such file or directory
[Michael@devserver ~]$
Where am I going astray? Thanks
 
Old 11-15-2014, 12:21 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,169

Rep: Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494
seeing as you installed it to /usr/local
it would not be in /usr/bin

is /usr/local even in the system path?
normally on a redhat system it is not

if you are going to build from source and not use yum
you might want to use the "--prefix=/usr " in the configure line

also /etc/bashrc is not the file you should add the search location to
that should be a script placed in "/etc/profile.d/"

or manually add the needed code to the /home/YourUserName/.bash_profile"

what guide are you trying to fallow ???
something for ubuntu or debian ?

you really should read the redhat documentation for cent https://access.redhat.com/documentat...erprise_Linux/

and the centwiki
( it is mostly cent5 but there is some cent6 and 7 in it )
http://wiki.centos.org/
 
Old 11-15-2014, 01:34 PM   #3
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 709

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by John VV View Post
if you are going to build from source and not use yum
I previously had git version 1.8.3.1 installed with yum, however, I need a newer version, and surprisingly couldn't find one.

Quote:
Originally Posted by John VV View Post
what guide are you trying to fallow ???
something for ubuntu or debian ?
The guide I was following is supposedly for Centos, and was titled "How to install the latest GIT version on CentOS" (http://www.howtoforge.com/how-to-ins...sion-on-centos)

Quote:
Originally Posted by John VV View Post
is /usr/local even in the system path?
normally on a redhat system it is not
I don't think so, but I think running the following allowed it to run for root:
Code:
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
The last line of my /etc/bashrc file is now:
Code:
export PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/git/bin
$PATH for both a normal user and root user is:
Code:
[Michael@devserver ~]$ echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/Michael/bin
[Michael@devserver ~]$ su -
Password:
[root@devserver ~]# echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/git/bin:/root/bin
[root@devserver ~]#
Sounds like the guide isn't a very good guide!

Could/should I just manually remove "/usr/local/git/bin" from the /etc/bashrc file?


Quote:
Originally Posted by John VV View Post
you might want to use the "--prefix=/usr " in the configure line

also /etc/bashrc is not the file you should add the search location to
that should be a script placed in "/etc/profile.d/"

or manually add the needed code to the /home/YourUserName/.bash_profile"
I would have liked it to be available to any user, and not have to configure each users /home/YourUserName/.bash_profile. Think I should start over, or is this salvageable? Could you help explain the following four lines? Thank you

Code:
make prefix=/usr/local/git all
make prefix=/usr/local/git install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
source /etc/bashrc
 
Old 11-15-2014, 01:55 PM   #4
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 709

Original Poster
Rep: Reputation: Disabled
Also found this tutorial http://tecadmin.net/install-git-2-0-...s-rhel-fedora/ which describes the same process. Please explain why it is wrong, and how it should be performed. Thans

Code:
# cd git-2.0.4
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
# source /etc/bashrc
 
Old 11-15-2014, 03:25 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,169

Rep: Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494
Quote:
I previously had git version 1.8.3.1 installed with yum, however, I need a newer version, and surprisingly couldn't find one.
not surprisingly at all
redhat LOCKED the versions of software before RHEL 6.0 was released in November of 2010
and these will STILL be the versions of software in rhel6.11 in 6 years when rhel6 hits "End of Life"

when you did this (- NOT the recommended way )
Quote:
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
did you REBOOT ?
if you edit anything in /etc you MUST reboot

adding a script in the folder /etc/profile.d is the recommended way

also if you build git ( or any program) out of the tree
not only will you need to export that "bin" folder
but the lib and share
and depending on what it is you might have to
add the lib folder to the ld.conf file
and/or add that lib folder to the $LD_LIBRARY_PATH
and might have to add the lib/pkgconfig to the $PKG_CONF_PATH
all the different locations are dependent on just what the software is

for git
the lib and share should be included

have you read the /etc/bashrc file ?
-- the warning on the top --
Quote:

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
 
Old 11-15-2014, 04:20 PM   #6
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 709

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by John VV View Post
redhat LOCKED the versions of software before RHEL 6.0 was released in November of 2010
But 3rd party repositories are available, no?

Quote:
Originally Posted by John VV View Post
when you did this (- NOT the recommended way )

did you REBOOT ?
if you edit anything in /etc you MUST reboot
Ooops...

Quote:
Originally Posted by John VV View Post
adding a script in the folder /etc/profile.d is the recommended way
And how would this be done? The same script as was added to my /etc/bashrc file?

Quote:
Originally Posted by John VV View Post
also if you build git ( or any program) out of the tree
not only will you need to export that "bin" folder
but the lib and share
and depending on what it is you might have to
add the lib folder to the ld.conf file
and/or add that lib folder to the $LD_LIBRARY_PATH
and might have to add the lib/pkgconfig to the $PKG_CONF_PATH
all the different locations are dependent on just what the software is

for git
the lib and share should be included
Yikes! How do you know which steps are required for any given program?

Quote:
Originally Posted by John VV View Post
have you read the /etc/bashrc file ?
-- the warning on the top --
Yes, I read it, but didn't think it applied to me... Okay, maybe it definitely does! The reason I suggested doing so is not to add script to this file, but to remove the part which was added by the suspect tutorials I was following.

Thanks for your help!
 
Old 11-15-2014, 06:07 PM   #7
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 709

Original Poster
Rep: Reputation: Disabled
Rebooting seemed to do the immediate trick, however, I know I still need to gain a better understanding.
 
Old 11-15-2014, 08:11 PM   #8
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,169

Rep: Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494
Quote:
I know I still need to gain a better understanding.
you should have read some of my posts back in 2004 and 5 on this and other forums


let's see

1) you are using ONLY terminal commands and cent
-- so a guess ?? a server install with not GUI
terminal ONLY !!!

Centos 6.4 , so you are aware that that is two versions out of date
cent only supports the CURRENT ONLY version
for 6 it is 6.6

so you HAD the older version of git installed
Code:
su -
yum install git
you did uninstall it ?before trying to install the new version

having two versions installed and being able to be seen by the OS and used -- is not that good

i will walk through this program
download git 2.13
https://www.kernel.org/pub/software/scm/git

the FIRST thing to do seeing as we are NOT getting it from the programs web site BUT from the mirror on "kernel.org"
is to "read the file"

-- some of this comes from just time and experience
Code:
cd git2.13
ls -a
look for Two text files
README and INSTALL
read them

in this case "readme" is just a software description
INSTALL is where the instructions are
Code:
nano INSTALL
--- or if you like ---
vi INSTALL
there are also some OTHER files that catch my attention
"aclocal.m4" ,"configure" and it's autoconf counterpart "configure.ac"

--- just my opinion but a lot of others also have it
I HATE "MAKEFILE" PROJECTS!!!!!!!

the beginning of the install instructions say you can just run "make"

i would READ and REREAD the "Makefile" F I R S T !!
makefile projects are notorious for having to manually edit that file to match your system
--- yes a bit of a rant

normally if there is a "configure" script you RUN that ( with options see the help page )
-- for the "help" options run
Code:
./configure --help
that will give you a ton of information

on redhat systems if i am installing in the normal root tree
/usr
/usr/bin
/usr/lib
and so on ...
i automatically just add the "prefix" location

if HOWEVER
i am installing it OUT OF THE SYSTEM TREE
for most things this is not needed

for somethings this is a MUST
this is where doing this for years and years comes in


i like to 100% make sure that software IS configured for MY hardware and operating system
99% of the time this is not needed
running this command to REMAKE the "configure" script
Code:
autoreconf -iv
if auto tools files are present you can do this
aclocal.m4 and configure.ac and or some others

as a normal NON root user ( most of the time this is NOT needed )
Code:
autoreconf -iv 
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: configure.ac: not using aclocal
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf
autoreconf: configure.ac: not using Autoheader
autoreconf: configure.ac: not using Automake
autoreconf: Leaving directory `.'
you installed it to /usr/local/git
-- OUT OF the system tree where the operating system CAN NOT SEE IT
for git that is NOT needed
installing it to /usr will ALLOW EVERY NON ROOT user to be able to use it

--- and that is what you want

so i would run this
Code:
 ./configure --prefix=/usr
--- terminal output  
many lines

---
many lines and if 

-- NO ERRORS --


configure: creating ./config.status
config.status: creating config.mak.autogen
config.status: executing config.mak.autogen commands
if there is an error
fix it and rerun configure
if not then "make"

this is a small simple program so running make on one thread of one CPU will do ( do not add "j 4" , or "j 8" or " j 32 ")

Code:
make
--- to use 4 CPU cores 
make -j 4
-- if there are NO errors
then become root BUT!!!!! with YOUR NORMAL USERS $PATH!!!!!!
Code:
su 
make install
the "su" is the short cut for root but with YOUR normal users paths and settings
"su - "
that dash makes a BIG difference
that uses the ROOT users $PATH and settings

now
every single non root user will be able to use this program

Code:
git clone  git://github.com/Syntopia/Fragmentarium.git

Last edited by John VV; 11-15-2014 at 08:18 PM.
 
Old 11-16-2014, 05:26 AM   #9
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 709

Original Poster
Rep: Reputation: Disabled
Thanks John,

Sorry, I am running Centos 6.6, not 6.4. I installed 6.4 on this machine but kept it updated. Maybe 7 soon?

Yes, a server with terminal only. Reasons are twofold. First, this machine is located in my house, and I wanted to be as similar as possible to my remote VPS. Second, I felt it would force me to more learn "real Linux" as I couldn't be reliant on a GUI. Maybe silly, but whatever...

For the remainder of your post, I will have to take some time to digit.

Thanks, Michael
 
Old 11-16-2014, 08:39 AM   #10
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,520

Rep: Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106Reputation: 2106
Quote:
Originally Posted by NotionCommotion View Post
Sorry, I am running Centos 6.6, not 6.4. I installed 6.4 on this machine but kept it updated. Maybe 7 soon?
It will only "auto update" through the minor version numbers. From 6.6 up to the last in the 6 series, probably 6.10 6 years from now. In order to switch to the 7 series you'll need to reinstall.
 
Old 11-16-2014, 02:23 PM   #11
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 709

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
It will only "auto update" through the minor version numbers. From 6.6 up to the last in the 6 series, probably 6.10 6 years from now. In order to switch to the 7 series you'll need to reinstall.
Acknowledged.

Question is whether now is a good time to do so.
 
Old 11-16-2014, 03:03 PM   #12
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,169

Rep: Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494
normally i would wait until the .1 or .2 if the new version of rhel comes out
BUT
it all depends on your needs

for example mine
i will NOT be upgrading to 7 any time soon
there is software i use that is for 6 and will NOT be upgraded any time soon
( i might be hacking that software to use rhel7 so...)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Is it possible to run program installed in root user by regular users? cent_sangeeta General 4 11-06-2012 10:35 AM
Executing MS windows based program which is installed through Wine as a non-root user akram Linux - Newbie 1 07-31-2009 05:18 AM
How to allow normal user to access a program under the root folder vitalstrike82 Slackware 2 11-08-2008 03:39 PM
Can root access be gained from regular user account without password? jdruin Linux - Security 5 11-22-2004 10:20 AM
How can a user access JBuilder9 installed as a root? CruelEssence Linux - Newbie 3 11-23-2003 12:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:52 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration