Installing softwares on Unix systems from source
Posted : June 8, 2004 at 10:33 pm [America/Los_Angeles]
Installing and uninstalling softwares from source has been a ritual I have been performing for some time now. Yes, package managers are incredibly user-friendly and their ability to download and install softwares by running one liners is indeed impressive. I do use it and have even blogged about it.
However, installing software using source code has its advantages. You’ve the power to tweak settings for greater security, performance optimizations, not to mention the ability to customize the source code itself. On a similar token, if you dabble too much with the code without knowing nearly enough, you’ve the power to royally mess yourself up as well 
Basically, installing a software from source involves the following standard steps most of the time. Refer to the README or INSTALL file that come with the source. There is a good chance it will say something along these lines. I will assume that all these commands are run in /downloads folder and that your unix account has full permissions on this folder.
(prompt)>cd /downloads
(prompt)>wget <url-to-download-tar-gzipped-file>
(prompt)> tar -xvzf <downloaded-tar-gzipped-file>
(prompt)> ./configure –help
(This will list all the options that you can pass to configure)
(prompt)>./configure [–prefix=/usr/local/<install-folder-root> along with other configure options]
(prompt)>make
(prompt)>make test (if such a target exists)
(root-prompt)#make install (run this last command as root)
Except the last command (hence the root-prompt next to it), all the steps can be performed as a regular unix user. However, soon I realized that it was this last step which would at times give me the anxiety attacks, especially when I was using the default –prefix settings (usually –prefix=/usr/local). What in the world did ‘make install’ do? Where did it install all the goodies? Did they really go where they were supposed to?
I decided to build a little tool by myself to remove this uncertainity. It can be downloaded from this location. Just put it in your path, make it an executable and run it without any command-line paramters.
Instead of regurgitating the way the tool works, I will just show you the output of this tool when you run the executable without any command-line parameters:
[root@morebytes]/home/anand$./tracker
Tracker, version 0.1-release (i386-redhat-linux-gnu)
Source: indrayam.com
Usage: ./tracker -{(s)tart|(f)inish|(v)ersion|(h)elp}
where:
-s|start =>gt; start capturing the current state of the filesystem
-f|finish =>gt; complete tracking
-v|version =>gt; version
-h|help =>gt; spit out this information
ASSUMPTIONS:
1. You've cat, sed and awk in your PATH
2. /bin/sh is a soft link to bash (version > 2.x). If not, change /bin/sh "
to /bin/bash (after downloading the latest version). Check the version "
of bash by running (unix-prompt)>bash --version
3. You're running this command with root privs (which is normally the case
when you run commands like 'make install'
AN EXAMPLE:
You're about to run 'make install' or any command that will install files
across the filesystem. While you know where the files will be installed,
you want to be sure
Here's how you use it:
(root-prompt)>tracker -s
(root-prompt)>make install (or whatever you plan to execute)
(root-prompt)>tracker -f
That's it!!
The difference in the filesystems before and after running the make install (or any command) will be stored in a text file under /downloads/install-files/<filename>.txt. This should take most of the guess work out of installing software from source code on a unix system. For example, what’s the worst you can do. Install with wrong config settings. No problem. Use the diff output to figure out the things that got added during the install. Remove it and you’re ready to start all over again.
Update:
Thanks to my anonymous friend who left a comment, I spent some time this morning trying to check out Checkinstall. It is an incredible tool and much much more powerful than what my utility offers. Go ahead, give it a try. I promise you’ll luv it.
- Anand
Category: Services and Software
3 Comments
Check out Checkinstall at http://freshmeat.net/projects/checkinstall/
Posted by: Anonymous at June 9, 2004 @ 5:41 am
Yup, checkinstall is great. It is a 1000 times more powerful than my util. Thank you Mr. or Ms. Anonymous..;-)
Posted by: Anand Sharma at June 9, 2004 @ 10:12 am
#include
struct record{
int cust_id;
char cust_type;
int cust_age;
char cust_name[20];
}
struct record r[10];
void main(){
FILE *fp,*fopen();
char filename[20];
int c,i;
printf(”enter the filename to be written to:\n”);
gets(filename);
fp=fopen(filename,”w”)
if(fp==NULL){
printf(”the %s file couldnt be written to”,filename);
exit(1);
}
else{
c=getc(fp);
while(c!=EOF){
for(i=0;i
Posted by: abhishek at June 6, 2006 @ 5:15 am