The vast majority of source packages can be built using what I call the extract and build five-step. I suppose that step one could also involve the downloading of the software, but I'll pretend you've already found and downloaded something, a hypothetical little package called ftl-travel, and you are now anxious to take it for a ride. I'll give you the five steps, then I will discuss them in more detail.
tar -xzvf ftl-travel-2.1.tar.gz cd ftl-travel-2.1 ./configure make su -c "make install"
Easy, isn't it? Now you can just type ftl-travel and be on your way. Now that you've seen a source package installation, let me give you some details.
Most program sources are distributed as tarballs, meaning that they have been stored using the tar archiving command. In the name above (ftl-travel-2.1.tar.gz) the ftl-travel part of it is the name of the program itself. The 2.1 represents the version number of the package, and the tar.gz tells us that this package is archived using the tar command and compressed using the gzip command.
You can, therefore, extract the archive with the command:
tar -xzvf ftl-travel-2.1.tar.gz
The x means extract. The z tells the tar command to use the gunzip command to extract. The v says that tar should show us a list of the files it is extracting?in other words, be verbose. Finally, the f identifies the file itself, the one you just downloaded.
Sometimes the extension .tar.gz will be shortened to .tgz. There are a few other extensions in use out there. For instance, the package may have a .tar.Z extension instead, meaning that the file has been compressed using the compress command. To extract the source from this tarball, you first uncompress the file using the uncompress command. Then you continue with your tar extract:
uncompress ftl-travel-2.1.tar.Z tar -xvf ftp-travel-2.1.tar
To make life even easier, you could also just shorten the whole thing to:
tar -xZvf filename.tar.Z
Every once in a while (if the package is very large), the extension will be .bz2, otherwise known as a bzip2 archive. To open this one, you perform essentially the same steps you did with compress. Use the command:
to uncompress the file, then extract using the standard tar command.
Once you have extracted the program source from the tar archive, change directory to the software's distribution directory. That's step 2. Using my current ftl-travel example, type cd ftl-travel-2.1. From there, I build and install my software, like this.
./configure make su -c "make install"
The ./configure step builds what is called a Makefile. The Makefile is used by the next command, make. In building the Makefile, the configure step collects information about your system and determines what needs to be compiled or recompiled in order to build your software. This brings us to the next step, which is to type make. You'll see a lot of information going by on your screen as programs are compiled and linked. Usually (after a successful compile), you follow the make command by typing su -c "make install". This will copy the software into the directories defined in the Makefile.
The reason that I have you type su -c "make install" is because the final step of an installation usually needs to be done by the root user. Because we don't want to be running as root on a regular basis (for security reasons), the su -c step lets us quickly jump into root user mode for one command (where you will be prompted for the root password) and just as quickly jump back out.
A number of programmers also provide a make uninstall option, should you decide that you do not want to keep the program around.
If you are an open source programmer (or plan to be one) and you want to make people happy, always provide an uninstall option.
If you are like me, you tend to want to just install and run that software, which is partly why I jumped ahead a bit and skipped a very important step. You generally do not have to do this because 95% of installs are the same, but . . . just before you go ahead with your final three steps, you should consider pausing in the source directory and typing ls to list the files in the directory. What you would see are numerous files, something like this:
CHANGES README Makefile Makefile.in configure INSTALL ftl-travel.h ftl-travel.c engine.c config.h
The first thing you want to do is read any README and INSTALL files. The next step is almost always going to be the ./configure step I mentioned as part of my extract and build the five-step, but there may be details you want to know about in those files. There may also be some prerequisites that you should know about or some personal options that you may want to set. It takes only a few minutes, and it may be extremely useful.
Way back when, at the beginning of this chapter, I mentioned that there was plenty of software available for your Linux system. Finding it isn't difficult and there are many ways to start your search. One way is to join a Linux User Group or chat with other Linux enthusiasts or users. That's a sure fire way of getting your hands on the latest, greatest, and coolest software.
Another way is to visit some of the more popular Linux software repositories. These include search engines for both packaged software (RPMs) and source (tarred and gzipped files). My favorites in this arena are Rpmfind and TuxFinder (I'll list all of these in the resources section). Take a moment as well to visit the monster archive at ibiblio.org.
You might also want to look at the project and review sites. My favorites in this group are Freshmeat, Sourceforge, and Linux TUCOWS.
Finally, if you are strictly looking for fun and games, check out Chapter 18 for a list dedicated to downtime.
At this rate, you'll never run out of software to try out!