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 07-24-2005, 09:06 PM   #1
gejoroni
LQ Newbie
 
Registered: Dec 2004
Distribution: SUSE 9.3
Posts: 19

Rep: Reputation: 0
could somebody please explain .tar installs and makefiles


I have tried to download several apps in .tar formatand I have always gotten explanations with make commands etc. Can somebody please explain what this process is actually doing? Thanks so much.
 
Old 07-24-2005, 09:19 PM   #2
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
In Linux you should always try to install software through your distro's package manager. Your profile says you're using Mandrake so you should go to http://easyurpmi.zarb.org and setup access to all the repositories. Its likely that whatever you're trying to install will then be available through the software installation thing in Mandrake Control Centre->Software. This is much easier (it installs automatically, you get updates for the main packages when you run your distros update program etc.).

Quote:
Can somebody please explain what this process is actually doing?
The tar (or tar.gz or tgz or tar.bz or whatever) file is just a compressed folder (ie. like you would zip a folder in windows) containing the source code of the program. Make is part of the build system which you would use to compile the source-code of that program into files that you can actually run. From make's manpage:
'The purpose of the make utility is to determine automatically which
pieces of a large program need to be recompiled, and issue the commands
to recompile them.'

However as I said above you're much better off getting the packages for your distro for software, trying to compile stuff can be a very complex (and time consuming) process.
 
Old 07-24-2005, 09:25 PM   #3
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
A tar file is like a zip file - it contains files and directories, usually in a compressed form to save storage and download time.

Most tar format source distributions have three steps:

1. configure

This is a script that checks to make sure that everything that is needed to compile the software is present. There are frequently multiple ways to do something on Linux/UNIX systems, and this script figures out which utilities are available as well. As output of the configure script, one or more "Makefile"s are created. A Makefile is a configuration file used in the next step.

2. make

Make is a utility that uses a Makefile as a configuration. That configuration tells "make" what files need to be compiled, and what options to use on the compilation. Following execution of a "make", the binary (executable) form of the programs are available.

3. make install

The "make install" also uses the Makefiles(s) as a configuration, to know which files need to be moved where, and what file attribute (permissions, for example) need to be set on those files. Following execution of "make install", the software should be ready to use.

Last edited by macemoneta; 07-24-2005 at 09:27 PM.
 
Old 07-24-2005, 09:35 PM   #4
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
Sure.

Many distributions allow you to download packages (such as those ending in .rpm) that contain binaries, basically the program itself. Some programs offer different packages for different distributions, but what is almost always available no matter what application you're trying to get is the source code, provided in a compressed archive ending in .tar.gz or .tar.bz2. Tar is the program that puts the files together in an archive, gzip (gz) or bzip2 (bz2) compress the archive so it takes up less space.

When you install source code, you're doing a few things.

1. Uncompress/extract the archive

Code:
tar zxvf filename.tar.gz
tar jxvf filename.tar.bz2
This will take all the files in the package and put them in a directory, usually with the same name as the filename except for the .tar.gz or .tar.bz2 part. The "z" or "j" tells tar whether to uncompress the archive with gzip or bzip2. The "x" tells tar it's extracting the archive, not making one. The "v" means "verbose" and will list the contents of the archive as it's being extracted showing you it's doing something rather than showing nothing until it's done. The "f" means the next argument will be the filename of the archive.

2. Figure out how to install the program

Code:
cd filename
less INSTALL
less README
Inside the directory that extracted the archive created, there's usually an INSTALL file (or README file) that explain what other programs you need before you install and the exact steps to follow. However, 95% of them will tell you to do the following:

3. Run the configure script

Code:
./configure
This runs the configure script (the . is an abbreviation for the current directory, so you're basically typing the full path to the script to run it). This will look at different aspects of your system, make sure you have everything the program requires, and create a "Makefile" that gives the compiler instructions for how to compile the program.

4. Make the program

Code:
make
This will tell the compiler to go through all the source code and create a binary (the program itself) from it. This usually takes the longest of all the steps, you'll see all the compiler commands scrolling across the screen until it's done.

5. Install the program

Code:
make install
The previous step compiled the program in the current directory. This step takes all the appropriate files and actually moves them to the various places on your system where they need to be (the binary to bin, the manual files to man, etc.). Since this works with directories other than the current one, it needs to be run as root (type "su" to become root and "exit" to return to your normal user when you're done). The previous commands should be done as a normal user (there's no reason to be root to run them).

That's about it. It seems hard at first, but once you understand what's going on it's really not that complicated and you can use the same steps over and over with everything you install. If you can't find a package right for your distribution you can always install from source, and the source versions are often more updated than the packaged ones.
 
Old 07-24-2005, 10:13 PM   #5
gejoroni
LQ Newbie
 
Registered: Dec 2004
Distribution: SUSE 9.3
Posts: 19

Original Poster
Rep: Reputation: 0
wow...thank you all so much...I never realized that I was compiling these things from source

I do know that using a package manager is the wiser choice, but sometimes I have no choice with some esoteric apps.

Just one followup question...once I successfully build the binary, how do I configure the shell (BASH) so that I can just type the app name instead of the full path?

Once again, thank you all for your help.
 
Old 07-24-2005, 10:17 PM   #6
jrdioko
Member
 
Registered: Oct 2002
Distribution: Debian 6.0.2 (squeeze)
Posts: 944

Rep: Reputation: 30
Make install should put the binary in a directory in your PATH so you can just type the name. Try "echo $PATH" to see all the directories in your PATH and "which appname" to see if something is available to run just by typing the name. If something doesn't get put there, you can add the following line to your ~/.bashrc file to permanently add a directory to your path:

Code:
export PATH=$PATH:/path/to/directory
 
Old 07-24-2005, 11:27 PM   #7
tkedwards
Senior Member
 
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
What's probably hapenning is that the stuff you compile is going into the /usr/local directory structure (where it belongs according to the file heirarchy standards for Linux). However most distros still don't have /usr/local/bin in the path by default. Putting a line like
Code:
export PATH=$PATH:/usr/local/bin
in your /etc/profile file will solve this problem for any user who logs into your system.
 
  


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
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 02:48 AM
tar tar cvf - . | (cd /root/; tar xvf -) ewt3y Linux - General 10 02-19-2014 10:55 AM
tar.gz installs ...could someone help? Astropicachu Linux - General 2 06-16-2004 10:45 AM
tar.bz2 file installs(mandrake) liljhand Linux - Newbie 4 05-15-2004 07:54 AM
Tar/Tapes: Can somebody explain this to me...... TheDirtyPenguin Linux - General 3 03-09-2004 04:37 AM

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

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