LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 05-13-2005, 09:14 PM   #1
NNP
Member
 
Registered: Nov 2004
Distribution: Debian/Ubuntu
Posts: 156

Rep: Reputation: 30
Where to install


Hi, i've just installed mandriva 2005. I have 3 partitions, one for / one for the swap file and another for home. The home partition is the largest by far. Im just wondering where I should install files and programs too. Do they have to go in /bin or /usr/bin? I assumed they would go in my home directory but the only folder there is my desktop. The reason i put home on a seperate partition was that I though I would be able to keep files if i changed distro. Is it ok to create a new folder in /home for installed programs (source and binary) or should i install them to somewhere else?

If I install another distro am i going to have to reinstall all my programs anyway or would putting them in /home prevent this?

Thanks,
NNP
 
Old 05-14-2005, 12:54 AM   #2
jarib
Member
 
Registered: Jun 2003
Location: British Columbia
Distribution: Slackware
Posts: 112

Rep: Reputation: 15
Use the home directory for documents, pictures, movies etc Things you want to keep. You could also keep program sources or binaries incase you need to reinstall programs
 
Old 05-14-2005, 01:33 AM   #3
akudewan
Member
 
Registered: Apr 2004
Location: India
Distribution: Ubuntu
Posts: 364

Rep: Reputation: 30
When I install apps from source, I compile them in my /home/akudewan/programs folder.

If I ever reinstall a distro on my root partition, then I'll just have to do "make install" for all the apps once again, and everything will be running.
 
Old 05-14-2005, 02:29 AM   #4
fuzzyash
Member
 
Registered: Aug 2003
Location: Melbourne Australia
Distribution: Fedora Core 4
Posts: 184

Rep: Reputation: 30
The general Linux convention for where to install programs, scripts, etc. that are compiled, written by the user, is in /usr/local. Depending on your distro, you should find that /usr/local has a normal, complete dir structure (ie. bin, etc, lib, man, sbin, share, etc.) but is empty (unless, of course, some other app, RPM, etc. has put something in there) Your /home dir should be where you keep everything that has nothing to do with the operation of the system, in other words, your projects, info, downloads, music, videos, images, porn, etc.

It is good practice to a) stick to convention, & b) keep everything that you install manually in the one place. This means that you have to add these locations to your config files only once.
Speaking of which, remember to add /usr/local/bin to your $PATH & also add /usr/local/lib to /etc/ld.so.conf & run /sbin/ldconfig as root.
 
Old 05-14-2005, 06:26 AM   #5
NNP
Member
 
Registered: Nov 2004
Distribution: Debian/Ubuntu
Posts: 156

Original Poster
Rep: Reputation: 30
Hey, thanks for the help guys. When I use the make command is the binary made in the same directory as the source files? If I want can i then copy that to a seperate directory for storage in my home directory if i want to install it in another distro later or will i have to go through the ./configure process etc? i.e should i just keep the source.

Up until i type make install are the only files that are created in my system within the directory im operating in or does make put stuff in any other folders? Just in case i want to delete stuff i want to make sure u get it all.

Fuzzyash, could you explain the last line of your post a bit more im a bit confused by it(as in I have no idea whats doing on)?
 
Old 05-14-2005, 12:02 PM   #6
fuzzyash
Member
 
Registered: Aug 2003
Location: Melbourne Australia
Distribution: Fedora Core 4
Posts: 184

Rep: Reputation: 30
In regards to your question "When I use the make command is the binary made in the same directory as the source files?" that all depends on what the Makefile tells it to do. But, as general rule, in my experience anyway, the directory that the main source file resides in is usually the one that you'll find the final binary in. What program are you wondering about in particularly? As most programs have more than just the executable binary, they would usually have libraries, config files, pixmaps, man pages, etc.

As for being able to simply copy just the binary to a completely different distro, this might work for extremely basic programs, but if it relies on being able to access libraries, or images or what have you, which almost all programs are, then there is no chance. The reason for this is that all distro's are fundamentally the same, as in they all use the same libraries & can all run the same apps, but the location in the filesystem that each one stores the different parts of the system can change enormously from distro to distro. For example, if you compile something under Fedora, & say it uses a library that already exists, which most programs do, during the configure stage, configure will find the library & hard code it's location into the binary, in Fedora this would usually be /usr/lib. Now, if you move that binary to a different distro, say SuSE, the library that your binary is dependent on to function correctly will usually be installed, but it will be in a different location. (I think SuSE likes to put things under /opt/lib) So when you try & run it, it will seg fault because it won't be able to locate the resources that it needs. This is called "breaking dependencies". This is where RPM's & DEB's & so on come into the picture. They are pre-compiled to run under ONE particular distro. RPM's are the best thing since sliced bread! They make installing progs extra easy!
So to answer your question, no, you most probably won't be able to just copy over the source that you compiled on a different distro & expect it to work. You will have to copy over the source tarball & recompile it from scratch.

Most programs are written in such a way that when they compile, they keep everything they are doing within their top level directory. There are some exceptions, but usually this is the case. What program are you wondering about?

Geez, this is becoming a long post.

As for the last line of my last post, at your terminal type:

echo $PATH

You should get something like:

/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/sbin:/sbin:/root/bin

This is called, surprise, surprise, your path! It is simply a list of dirs that the system searches in whenever you execute something. For example, to run cp, instead of typing out the entire path - /bin/cp - every time you want to copy something, you only need type cp & the system takes care of the rest because /bin is in your path. This is why files of the same type, especially executables, are all stored in the same place. Now, when I say "remember to add /usr/local/bin to your $PATH", this means that you need to edit the file that creates this path for you & add /usr/local/bin to the $PATH variable. Because if you don't, every time that you want to run whatever it is that you are putting in there, you would have to type out the entire path instead of just the name of the program itself.
This is done is by editing .bash_profile in your home dir if you only want the changes to only affect your user, or you can edit /etc/profile if you want the changes to affect every user on your system.

In ~/.bash_profile, find the following lines, somewhere near the bottom:

############################################################################

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME

############################################################################

then change

PATH=$PATH:$HOME/bin

to

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

As for /etc/profile, somewhere near the bottom,

############################################################################

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

############################################################################

add the following just before the line that starts "export PATH USER..."

PATH=$PATH:/usr/local/bin

Now your $PATH variable knows that you want to be able to access /usr/local/bin from anywhere in the filesystem. You can add as many as you like, each one just has to be separated by a ":" (eg: $PATH:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin)


The other thing was, "add /usr/local/lib to /etc/ld.so.conf & run /sbin/ldconfig as root"
To cut a long story short, /etc/ld.so.conf is a list of where to find library files, then running "/sbin/ldconfig as root" sorts through & updates how all the linked libraries link together. Basically, if you start installing programs to other places in the filesystem, whichever dir that the libraries end up in, must be added to /etc/ld.so.conf so that /sbin/ldconfig knows where to find all the new linked libraries, & be able to link them to the files that were used to create them when they got compiled. See man ldconfig for more.


I don't know how much of that you already knew, but, you asked for it!

There's a hell of a lot more to it than that too. The Linux filesystem for each distro works in a different way, but the underlying "rules" mean that to take advantage of all it's power you need to learn how it works. This is a grouse site, I've read it start to finish a few times & check it for reference all the time. Check it out, --> http://www.tldp.org/LDP/intro-linux/html/index.html if you don't learn something from here, your just not tiring!
This is an excellent doc for all things Linux. Read it start to finish & you'll be
 
Old 05-14-2005, 01:40 PM   #7
NNP
Member
 
Registered: Nov 2004
Distribution: Debian/Ubuntu
Posts: 156

Original Poster
Rep: Reputation: 30
thanks, that helped a lot.

I have one problem though, when i added /usr/local/lib to /etc/ld.so.conf and then run ldconfig i get the following error when i try to open kate (or many other programs except emacs)

Code:
[nnp@localhost ~]$ su -m
Password:
[root@localhost ~]# /sbin/ldconfig
[root@localhost ~]# kate
Error: "/var/tmp/kdecache-nnp" is owned by uid 500 instead of uid 0.
Link points to "/var/tmp/kdecache-root"
kate: ERROR: Communication problem with kate, it probably crashed.
Any ideas?

Thanks,
NNP

Last edited by NNP; 05-14-2005 at 03:15 PM.
 
Old 05-14-2005, 10:55 PM   #8
fuzzyash
Member
 
Registered: Aug 2003
Location: Melbourne Australia
Distribution: Fedora Core 4
Posts: 184

Rep: Reputation: 30
For starters, when you su to root, use: su - instead of: su -m The -m argument preserves your restricted users environment variables. Root is supposed to have a uid of 0, using the -m arg means that you get root privileges, but it doesn't not set all the variables that root needs to do it's job correctly. So it keeps the uid of you restricted user, 500. Thus, anything you do as root will look to other programs as tho it was done by someone other than root because it will leave any files that it modified with a "owned by" value of 500, not 0 which it should be. This is a bad thing, &, like you are experiencing, most of your programs will refuse to run, it's a security thing. To fix this, log out of root, then log back in with:

su -

Don't forget the "-", this tells su to act as a normal login shell. See "man su" for details. Then run ldconfig again. If this does not fix the problem, you might have to move everything in /var/tmp/ to somewhere in your home dir, move it, don't delete it. This dir if for caching data during a session, so it's not important, but hang on to it just in case. You might also have to do this with everything in /tmp/ as well.
But first, just try running ldconfig with the correct environment variables for root, this should fix it.
 
  


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
fc3 install doesnt install grub properly onto sata drive sabo Linux - Newbie 4 02-03-2007 04:04 PM
make install does not install daemons (clamd snortd). Is this a feature of tarball? Emmanuel_uk Linux - Newbie 3 11-15-2005 01:29 AM
Error: Unable to boot /install/2.6/linux when starting Etch Install BuckRogers01 Debian 4 08-06-2005 06:40 PM
How do I re-install an operatingsystem? Corrupted install. Yast wont load. URGENT.thx CrewXp SUSE / openSUSE 5 05-09-2005 12:07 AM
knoppix liveCD install works great, HD install not so good stephanie_k Linux - Newbie 3 05-10-2004 09:41 AM


All times are GMT -5. The time now is 04:42 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