1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

The Techguy Linux Software from source HOWTO

Discussion in 'Linux and Unix' started by Whiteskin, Mar 20, 2005.

Advertisement
  1. Whiteskin

    Whiteskin Thread Starter

    Joined:
    Nov 15, 2002
    Messages:
    1,964
    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.)
     
  2. cheese

    cheese

    Joined:
    Jun 22, 2003
    Messages:
    2,563
    Sticky for Whiteskin!
     
  3. mushka

    mushka

    Joined:
    Sep 21, 2004
    Messages:
    51
    I searched for quite a while to find such a wonderfully simple guide to installing from source.

    many thanks

    chz
    ben
     
  4. mushka

    mushka

    Joined:
    Sep 21, 2004
    Messages:
    51
    and cheers to Cheese for making it stick

    *BUMP*
     
  5. CouchMaster

    CouchMaster

    Joined:
    May 26, 2003
    Messages:
    3,303
    Straight forward, plain English - Everything should be so easy!
     
  6. xico

    xico

    Joined:
    Jun 29, 2002
    Messages:
    29,787
    Hi Whiteskin,

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

    xico

    Joined:
    Jun 29, 2002
    Messages:
    29,787
    Better yet will I be able to install Ubuntu with the information here?
     
  8. Big-K

    Big-K

    Joined:
    Nov 22, 2003
    Messages:
    6,052
    No. That information is for installing programs. Ubuntu, like most distros, comes with it's own installer(which uses dos-style graphics).
     
  9. I Fix 4 U

    I Fix 4 U

    Joined:
    Jul 19, 2004
    Messages:
    5,646
    Ubuntu is easy enough to install.
     
  10. Randolf34

    Randolf34 Banned

    Joined:
    Nov 28, 2005
    Messages:
    341
    how about red hat 9.0? having fun with finding iso9660 cd images despite downloads of
    everything in sight.
     
  11. I Fix 4 U

    I Fix 4 U

    Joined:
    Jul 19, 2004
    Messages:
    5,646
    ^Old IMO. Quite old, i'd use fedora if you want redhat, unless you pay.
     
  12. bearqst

    bearqst

    Joined:
    May 21, 2004
    Messages:
    163
    Or WhiteBox for the RHEL4
     
  13. rob.rice

    rob.rice

    Joined:
    Apr 17, 2006
    Messages:
    731
    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
     
  14. jarchack

    jarchack

    Joined:
    Apr 1, 2004
    Messages:
    17
    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.
     
  15. klam

    klam

    Joined:
    Apr 21, 2006
    Messages:
    147
    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? :D (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
     
  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...

Short URL to this thread: https://techguy.org/343742