HOW TO INSTALL (most) SOFTWARE FROM (most) SOURCE CODE DISTRIBUTIONS

Copyright (C) 2004 Daniel Brodzik
This document is free software; you may distribute and/or modify it under the terms of the GNU Free Documentation License; either version 1.2 of the license or, at your option, any later version, with no Front Cover Texts, no Back Cover Texts, and no Invariant Sections.

Here's what you need to know to install most programs from their source code. PLEASE note that I'm saying "most"; each program could have its own way of compiling and installing, so you shouldn't assume that every program is the same in this respect. That said, most programs for Linux and other Unices compile the same. Here are some general installation instructions that you can try.

These directions do not work for the Linux kernel. For more information on compiling the Linux kernel, take a look at my guide to compiling the Linux kernel in Debian. It's included with the rest of my guides.

1. Download the program's source 'tarball' (a .tar, .tar.gz, .tgz, .tar.bz2, .tbz, .tbz2 file). (For those of you with DOS and/or Windows experience, a tarball is to Unix and Linux what a zip file is to DOS and Windows. Yes, both tarballs and zip files can be used on all of these.) Put the tarball in a directory that you have read and write permissions to as a normal user (that is, NOT as root). I'd recommend your home directory.

2. Get to a command prompt and log to the directory you put the tarball in.

3. Follow step 3A if the TAR filename ends in '.tar'. Follow step 3B if the filename ends in '.tar.gz' OR '.tgz'. Follow step 3C if the filename ends in '.tar.bz2', '.tbz', or '.tbz2'.

3A. Type 'tar -xvf filename' where filename is the name of the tarball, including the '.tar' extension.

3B. Type 'tar -zxvf filename' where filename is the filename of the tarball including the '.tar.gz' or '.tgz' extensions.

3C. Type 'tar -jxvf filename' where filename is the filename of the tarball including the '.tar.bz2', '.tbz', or '.tbz2' extensions.

4. BEFORE PROCEEDING, READ THE DOCUMENTATION THAT CAME WITH THE SOFTWARE! In particular, read the files README and INSTALL. To do that, type 'less README' and 'less INSTALL' from the new directory created above. You'll know what the name of the directory is by reading the screen output from the 'tar' command.

5. If you followed step 4 above, then follow the directions. If they say something about running './configure', 'make', and 'make install', then proceed. If you didn't read the directions, then I will not be responsible for anything bad that happens if you read on here. The directions that follow will work with ~90% of Linux-based software's source code.

7. Try typing './configure'; this will tailor the makefile for your configuration and inform you of whether you're missing something needed for compiling the source code. If that gives you an error message stating that it can't find 'configure', then try typing 'cd src' or 'cd source' or typing 'ls' to see a directory listing, and then try './configure' again. If you cannot run configure, then edit the makefile. This can be done using nano, emacs, or any other text editor. Try 'nano Makefile' or 'nano makefile'. If you succeeded in this, proceed to the next step.

8. Type 'make'.

9. If make succeeds, then type 'su' to become the superuser (also known as root) so that you can install the program. You will need to know your root password.

9. Type "make install" to install the program. If that failed, then type 'ls --color' and look for a new executable (in green). Type 'cp (executable) /usr/local/bin'.

10. If this procedure succeeded, then type 'exit'. You're now done.

NOTE: If 'configure' says you're missing a library (like GTK), then you will not only need the library installed, but also its development files. If you have a package manager (like Debian's dpkg/dselect), then run your package manager and install the development files for the library you need, and try again.
1