North Idaho Linux Users Group

Categories

Downloads

Archives

Installing Linux Applications From Source

Whether your Linux system uses apt-get or rpm to install new software, it is occasionally necessary to install a program or library from the source code.

Source code for programs is often packaged into archive 'tarballs'. These tarballs have file names that end in tar.gz, tgz, .gz or .bz2. These archives contain the actual source code and instructions on how to compile and install the program.

Here are the steps you need to install such programs on your Linux system. They are meant to be typed into a terminal session.

1. Copy or save the program archive file someplace in your home directory. I have a subdirectory in my home directory called Downloads where I usually store these files.

2. Unpack the file. For instance, if you have a program archive file called lame-3.96.1.tar.gz, then you can unpack it with

tar xvfz lame-3.96.1.tar.gz

This will create at least one subdirectory and will unpack all the files into that subdirectory.

A word about the tar command: the command line arguments (xvfz) tell tar what to do. The 'x' means extract, the 'v' means verbose, the 'f' means use an archive file (in this case, lame-3.96.1.tar.gz) and the 'z' means to gunzip the archive before unpacking it. If your program comes in a bzip package (.bz2 extension), then the arguments would be xvfj.

3. Go into the created subdirectory. For our example, the command to do this would be

cd lame-3.96.1

4. Look for instructions on how to compile and install this program. There will be a file, usually with a name in all caps (like README, INSTALL, etc) that contains instruction on how to compile and install the program. You can read these files with the 'less' command:

less INSTALL

Use the regular navigation keys to get around in the file. Type 'q' to leave it.

5. The normal steps for doing the compiling and installing are

./configure
make
su -c "make install"

Note that the last command is done with the root account, This is necessary because the installation may write files to directories for which the normal user account has no write access.

The 'configure' command looks at your system and determines if it contains everything necessary to create the program executable file. The 'make' command actually builds the program executable, and the 'make install' command installs it.

That's all there is to it. Have fun!