The vast majority of source packages can be built using what I call the extract and build five-step. I suppose that step 1 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 that 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. Step 1: Unpacking the ArchiveMost program sources are distributed as tarballs, meaning that they have been stored using the tar archiving command. In the name just listed (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 this 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 bunzip2 ftl-drive-1.01.tar.bz2 to uncompress the file; then extract using the standard tar command. Steps 2 5: Building Your ProgramsOnce 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.
A number of programmers also provide a make uninstall option, should you decide you do not want to keep the program around.
README, Please!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 you should know about or some personal options you may want to set. It takes only a few minutes, and it may be extremely useful. Getting Your Hands on SoftwareWay 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 surefire 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 pbone.net and TuxFinder (I list all of these in the Resources section). Take a moment as well to visit the monster archive at ibiblio.org. For Debian packages, you can also take a look at packages.debian.org. You might also want to look at the project and review sites. My favorites in this group are Freshmeat, SourceForge, and Linux TUCOWS. At this rate, you'll never run out of software to try out! |