# The Techguy Linux Software from source HOWTO



## Whiteskin

Techguy Linux-HOWTO: Compile a program from source
($ means as a regular user
# means as root)
The first time one needs to build a program from source, the idea to a new linux user is daunting. But once one has the basics, the procedure becomes quite simple and reptitive.

Almost all program building involves the program 'make'. Make is a special program, which reads input files and performs actions based upon those input files. These files are called Makefiles. One does not, however, need to know how to read nor write these files to build software.

The first thing one does is unpack the archive the source came in.
(Select one based on the extention)
tar xvfz program.tar.gz
tar xvfj program.tar.bz2

Under normal circumstances this will create a folder called program in the current directory. CD into it.

When one builds a program, the simplest of actions is the following:

$ make

Make will then perform the needed action to build the program. After this, you will have your binary in the folder.

Some programs reqire special placing on the drive, and thus need a second command (usually performed as root).


Code:


$ make
# make install

This makes the program, and as root, installs it. Boom, program installed.

More complex programs however, need to know about your system, what is installed, if it's dependencies are satisfied etc.

A third step is now introduced.



Code:


$ ./configure
$ make
# make install

The './configure' tells your shell to execute the script in the current directory called configure. Output will go by, as configure searches for the needed programs and libraries, and outputs the specialized makefiles.

Program installed!

(This howto is very basic. I don't cover more advanced topics like alternate make targets, configure options, automake/gen however it should be good for basics.)


----------



## cheese

Sticky for Whiteskin!


----------



## mushka

I searched for quite a while to find such a wonderfully simple guide to installing from source.

many thanks

chz
ben


----------



## mushka

and cheers to Cheese for making it stick

*BUMP*


----------



## CouchMaster

Straight forward, plain English - Everything should be so easy!


----------



## xico

Whiteskin said:



> Techguy Linux-HOWTO: Compile a program from source
> ($ means as a regular user
> # means as root)
> The first time one needs to build a program from source, the idea to a new linux user is daunting. But once one has the basics, the procedure becomes quite simple and reptitive.
> 
> Almost all program building involves the program 'make'. Make is a special program, which reads input files and performs actions based upon those input files. These files are called Makefiles. One does not, however, need to know how to read nor write these files to build software.
> 
> The first thing one does is unpack the archive the source came in.
> (Select one based on the extention)
> tar xvfz program.tar.gz
> tar xvfj program.tar.bz2
> 
> Under normal circumstances this will create a folder called program in the current directory. CD into it.
> 
> When one builds a program, the simplest of actions is the following:
> 
> $ make
> 
> Make will then perform the needed action to build the program. After this, you will have your binary in the folder.
> 
> Some programs reqire special placing on the drive, and thus need a second command (usually performed as root).
> 
> 
> Code:
> 
> 
> $ make
> # make install
> 
> This makes the program, and as root, installs it. Boom, program installed.
> 
> More complex programs however, need to know about your system, what is installed, if it's dependencies are satisfied etc.
> 
> A third step is now introduced.
> 
> 
> 
> Code:
> 
> 
> $ ./configure
> $ make
> # make install
> 
> The './configure' tells your shell to execute the script in the current directory called configure. Output will go by, as configure searches for the needed programs and libraries, and outputs the specialized makefiles.
> 
> Program installed!
> 
> (This howto is very basic. I don't cover more advanced topics like alternate make targets, configure options, automake/gen however it should be good for basics.)


Hi Whiteskin,

I'm ready to install Ubuntu. Are there any further instructions, aside from this very good post?


----------



## xico

Whiteskin said:


> Techguy Linux-HOWTO: Compile a program from source
> ($ means as a regular user
> # means as root)
> The first time one needs to build a program from source, the idea to a new linux user is daunting. But once one has the basics, the procedure becomes quite simple and reptitive.
> 
> Almost all program building involves the program 'make'. Make is a special program, which reads input files and performs actions based upon those input files. These files are called Makefiles. One does not, however, need to know how to read nor write these files to build software.
> 
> The first thing one does is unpack the archive the source came in.
> (Select one based on the extention)
> tar xvfz program.tar.gz
> tar xvfj program.tar.bz2
> 
> Under normal circumstances this will create a folder called program in the current directory. CD into it.
> 
> When one builds a program, the simplest of actions is the following:
> 
> $ make
> 
> Make will then perform the needed action to build the program. After this, you will have your binary in the folder.
> 
> Some programs reqire special placing on the drive, and thus need a second command (usually performed as root).
> 
> 
> Code:
> 
> 
> $ make
> # make install
> 
> This makes the program, and as root, installs it. Boom, program installed.
> 
> More complex programs however, need to know about your system, what is installed, if it's dependencies are satisfied etc.
> 
> A third step is now introduced.
> 
> 
> 
> Code:
> 
> 
> $ ./configure
> $ make
> # make install
> 
> The './configure' tells your shell to execute the script in the current directory called configure. Output will go by, as configure searches for the needed programs and libraries, and outputs the specialized makefiles.
> 
> Program installed!
> 
> (This howto is very basic. I don't cover more advanced topics like alternate make targets, configure options, automake/gen however it should be good for basics.)


Better yet will I be able to install Ubuntu with the information here?


----------



## Big-K

No. That information is for installing programs. Ubuntu, like most distros, comes with it's own installer(which uses dos-style graphics).


----------



## I Fix 4 U

Ubuntu is easy enough to install.


----------



## Randolf34

how about red hat 9.0? having fun with finding iso9660 cd images despite downloads of
everything in sight.


----------



## I Fix 4 U

^Old IMO. Quite old, i'd use fedora if you want redhat, unless you pay.


----------



## bearqst

Or WhiteBox for the RHEL4


----------



## rob.rice

well one important thing was left out
always always right after untaring the archive read the README file 
"$less README "
this is even more important if there is a configure script to run because alot of functionality depends on configuration options and you could miss out on what your installing the program for in the first place
another good idea is to keep the Makefile around just in case you want to uninstall the program a good place to do this is to make a directory named after the program in "/usr/doc" you should also copy the text documentation to this directory including the README file


----------



## jarchack

Many modern distros like ubuntu and red hat have package managers and repositories with prebuilt software. Although many apps can be compiled and installed (assuming dependencies are fulfilled) you may end up hosing your distros package manager database. eg, you can download, extract, compile and install the latest version of software-x.xx but when you go to use apt or synaptic afterwords it will tell you that there's a broken package. With ubuntu being Debian based I don't thing there's a single application that hasn't already been made into a .deb file.


----------



## klam

Pretty nice mini-tuto so simple and so clean. Now my question is... how do you go about uninstalling the program since *nix don't have the add/remove programs?  (assuming the program installed doesn't have an uninstall option)

Don't tell me it's like Mac that u just drag the whole folder to the recycle bin lol


----------



## KHAYMAN

Well, thats a big thank you from me! I now have an idea on how to install programs on Linux. Hurray!!!

MANY THANKS


----------



## kungfu

ok my basic trouble shooting is how to install program on linux os
say i have this media player
amarok-1.4.0-1.1.20060mdk.i586.rpm
now my point is how to install this media player software
pliz be more in details and possibe in step wise for which i will be very grateful


----------



## briealeida

Instructions on how to Install from RPM.
http://www.tuxfiles.org/linuxhelp/rpminstall.html

Got that from Googling 'how to uninstall RPM'

How to uninstall software from Linux.
Depends on how you installed it.
rpm -e software
if you use rpms.

If you're using apt-get, try 
apt-get remove software

But that was posted a long time ago so you probably won't read this. lol.


----------



## richardfj

I am not, by any stretch of the imagination, computer literate,rather too old and long in the tooth to learn new disciplines,however I am interested enough to have realized that the major opperating system out there sucks.For a while now I have been running a duel boot,xp v ubuntu,but have now decided to bite the bullet and run ubuntu exclusively.I am sure that there are many more people out there who would do the same but for one thing,geek speak!
Now dont get me wrong,two of my sons are a bit geeky and they talk a language which is beyond grasp,but I still love them,sometimes.My point is that I would be much more comfortable with Linux if I could understand the the instructions for simple things such as installing software,as it is I have had endless attempts at installing a dvd player for example,with no success,or perhaps I should say I can install it but it wont work.I seem to get conflicting advice from the various 'experts' and will probably give up on it soon,after all I do have a dvd player built for purpose.
So you tech guys out there please remember that not all computer users are as clever as you and try to help us ordinary folk by dumbing down a bit and occasionaly using plain language,as found in the opening item in this forum.


----------



## tomdkat

rob.rice said:


> well one important thing was left out
> always always right after untaring the archive read the README file


I second this along with reading a file called "INSTALL" or "install.txt" which should have a step-by-step installation procedure for the app being built.

"make test", "make tests" or "make check" should also be used to make sure the app just built actually works. Some apps have test that come with the tarball and some don't.

So, when I install an app (like the Pidgin 2.1.1 upgrade I installed last night), I usually do this:

$ tar zxf [app-version-tarball].tar.gz
$ cd [app-version-dir]
$ more README
$ more INSTALL
$ ./configure [options, if necessary]
$ time make (so I can see long it took to build)
$ make test (or make tests or make check)
$ su
# make install
# exit
$ exit

This is on my 64-bit Ubuntu Feisty Fawn Linux system at home. 

Peace...


----------



## varaahan

Simple! Delete the concerned program folder !
The command is (as root) :
rm -rf <path_to_program_folder>


----------



## varaahan

As root user execute the "rm -rf <program folder> " command.


----------

