LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 04-05-2006, 10:55 PM   #1
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Rep: Reputation: 30
Installing Software Properly from Source


Hi, I have been using linux (Slackware) for six months now, but I still do not know how to install software properly. I know the basic drill. Download the package. Unpack it it. Type these three commands:
./configure
make
make install
That's all it takes right? Nope. Because what if you want to uninstall something later. Ah, now we need to make a package in a .tgz, .deb, or .rpm. Oh, but now we need to pass parameters to ./config so that make will install all the files into a seperate directory. Oh, but make sometimes ignores directory paths set by ./configure. Now what? You see installing software is not trivial like most tutorials make it out to be. Give me a proper education and I will try my best to write a tutorial on making packages (I'm not kidding, I will submit it). I know a lot of you will point out the tutorial on linuxpackages.net. I know about it. It still does not explain much. It does not explain why we change the permission on the files or what the --prefix options are really for. Like what is the difference between /usr/local and /usr. Sure, the FHS document explains these differences abstractly. I like examples, don't you, and who wants to go on an easter egg hunt to find out the difference? To a novice linux user, who wants everything to work correctly, installing software can be the most frustrating part of linux. Let's help them (and me) out.
I have thought about using chroot to install very tricky programs that insist on installing in /usr/local. Is this possible or should I just stick with checkinstall? It would be nice to learn the hard way before using a program to make thing easier. It brings about an appreciation of work done and really gives you an understanding of what is being done. Please share your ideas. Thanks
 
Old 04-05-2006, 10:57 PM   #2
tormented_one
Member
 
Registered: Oct 2004
Location: Small Town USA
Distribution: slamd64 2.6.12 Slackware 2.4.32 Windows XP x64 pro
Posts: 383

Rep: Reputation: 30
check out checkinstall
 
Old 04-05-2006, 11:15 PM   #3
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Original Poster
Rep: Reputation: 30
I know my starting state/question is kind of long, but I mentioned that in the second to last sentence. Checkinstall is not the whole answer. That's what I'm pointing out. It is important to know the hard way too.
 
Old 04-06-2006, 10:43 AM   #4
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Quote:
Because what if you want to uninstall something later.
Most make files come with an uninstall rutine. If you keep all of the source you install from, you can come back to it later and do a 'make uninstall'

Quote:
Ah, now we need to make a package in a .tgz, .deb, or .rpm
I prefere not to use these formats. You get more controll form compiling form the source.

Quote:
It does not explain why we change the permission on the files or what the --prefix options are really for.
I've never had to change file permissions on files I have just installed. This should not be necisary if you install in /usr/local. The --prefix options specifies the install path.

Quote:
what is the difference between /usr/local and /usr
/usr/local a common directory shared by all non root users. The standard is to install all new software (not installed by distro) in this folder.

Quote:
I have thought about using chroot to install very tricky programs that insist on installing in /usr/local.
I recommend installing all your programs in /usr/local. But that's just because I don't like to hunt around for my crap if I don't remember where I installed it at.

Let me know if you have any other questions. It took me awhile before I understood what's really going on when I install new software. Keep at it, you'll be a linux pro in no time.

regards,
...drkstr

Last edited by drkstr; 04-06-2006 at 10:46 AM.
 
Old 04-06-2006, 11:04 AM   #5
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
There is no easy way for uninstalling programs and make uninstall doesn't always work as well (sometimes there isn't such an option in the makefile). Checkinstall&installpkg helps because it remembers (writes into file) where each file is placed. When you try to uninstall it checks if this file isn't used by any other program and if it's not, then removes it. Otherwise you can look at makefile and delete the installed files manually (some kind of stupid suggestion because some programs have thousands of files and it will fed you up before removing all files). As well, this way can mess up your system easily because you can delete very important files. Linux is not Windows where each program has its own directory and package managers weren't created accidentally.

Last edited by Alien_Hominid; 04-06-2006 at 11:06 AM.
 
Old 04-06-2006, 12:10 PM   #6
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Original Poster
Rep: Reputation: 30
When I get two people saying contradictory things, I know I'm working with a complicated subject. I'm with Alien Hominid. Packaging the files after they are built makes a lot of sense even if it is overkill. As far as /usr/local is concerned, I recently had a lot of trouble installing glib in Slackware. The .pc file was not being copied to the correct location so pkg-congif was saying it wasn't installed. This held me up for about two weeks before I finally change --prefix and --exec-prefix options to /usr. This may not have been the best solution, but it is a working solution. After that amount of trouble, I decided to make this post to hammer everything out and to help newer users

I'm gonna say that to install something correctly, you need to build a package. That said, let's just deal with the ./configure script and possibly changing permissions on files as many other sites suggest. Before you build a package, you should configure it correctly. That requires us to become familiar with the configure options. Where do we find those options? Is the INSTALL file the only place to look for them? I looked up configure on google and came up with this site:
http://www.airs.com/ian/configure/
He says that --prefix and --exec-prefix are the only options we should have to deal with.

For permissions, it makes sense to change the permissions of say the /etc files to whatever permissions you have in /etc, but the way most sites recommend to change them seems strange. After all, the package program will want to change our settings anyway. Look at this site
http://www.linuxpackages.net/howto.p...=Package+Howto
if you don't know what I'm talking about.

Well, that's it from me for now. Thanks guys.
 
Old 04-06-2006, 12:45 PM   #7
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
For configure options, run ./configure --help. This will post them. Glib is default package in Slackware and it goes into /usr (/usr/lib). It is configured in install.sh script in the official package. However, you should know that by default user compiled packages in Slackware goes to /usr/local. That's why you couldn't find glib and that's why you should use official Slackware packages, because files are placed where they are expected to be. Or if you tried to compile yourself, you needed to change the default prefix into /usr because it's system wide package and it should be in your path.
 
Old 04-06-2006, 11:30 PM   #8
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Original Poster
Rep: Reputation: 30
Ya, I could find glib, but the system could not. I guess if a library was installed by Slackware, I need to place the program/library where Slackware put it. I still can't figure out why pkg-config could not find the .pc file. There should be two places for .pc files, one in /usr/lib/pkgconfig and one in /usr/local/lib/pkgconfig. There is only one directory that it looks in though. What happens if I get a program that needs to be put in /usr/local/ rather than user and also needs .pc file. Should I find the .pc file and alter it's contents and place it in /usr/lib/pkgconfig? I guess another way to ask this question would be: how does a .pc file get created, and where is it placed?
 
Old 04-07-2006, 05:17 AM   #9
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
Official Slackware and other common Unix system packages usually are placed in /usr, while the packages you compile and install usually go to /usr/local unless you change the prefix. You should export PKG_CONFIG=/some/path before installation to show where to search.
 
Old 04-08-2006, 06:26 PM   #10
binarybob0001
Member
 
Registered: Dec 2004
Distribution: Debian Wheezy
Posts: 444

Original Poster
Rep: Reputation: 30
All right, we are doing much better now! Alien Hominid, thank you for sharing so much of your knowledge. I'm beginning to have a much easier time installing software. There is so much to learn though.

How might I change what architecture my compiler uses? ei: i386 to i686
No one has mentioned anything else about changing file permissions yet.

For those following along the PKG_CONFIG environment variable below should be PKG_CONFIG_PATH. I looked it up on the man page.

I have had problems compiling a program when I set the --prefix option to /usr instead of /usr/local. The compiler was unable to find a library with /usr set, but able to find the library when /usr/local was set. I'm not sure if this should be addressed in this thread (It is a common problem) or not.

Well, I think these are the last of the ./configure options that most people would want to know. I'll make sure to write up the first part of my tutorial after the two questions above are answered. Just as I said I would.
 
  


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
installing software thru source leeban99 Linux - Software 4 01-01-2006 11:58 AM
installing software from source, make uninstall question darkleaf Linux - Software 2 08-19-2004 04:18 PM
Installing Software from source.. bin. tar. Vm Consoles, TCL??? murbz Linux - Software 3 07-15-2004 05:08 PM
how to properly install kernel source in Debian ? kix_vn Debian 8 03-20-2004 01:30 PM
Installing software: RPM vs source tarballed Linux - Software 6 08-31-2003 02:58 PM

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

All times are GMT -5. The time now is 08:22 AM.

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