Before you run the configure command, first extract the software source code by using the tar command, which is much like unzipping a .zip file by using WinZip:
# tar -xzf software.tgz
Typically, when you extract software source from a tar file, a subdirectory is created with the software name and version. You need to change into that subdirectory to actually compile the software, as follows:
# cd ./software-1.0
(For software, type the name of the software as it's shown in the directory.) Now, you're ready to run the configure command:
# ./configure
The configure script performs a series of tests against the system and decides how best to compile the software. If Autoconf determines that the source code won't compile properly against the system, the configure script will abort with an error message. The most common error is that the server doesn't have required software installed (e.g., the GNU Compiler Collection—GCC—compiler). After you install the necessary software, rerun the configure script to let it finish.
After the configure script finishes, issue the make command. The make command reads the file Makefile, which the configure script generated. This file contains a set of instructions that dictate how the source code will be compiled.
New Linux administrators often make the mistake of issuing the make command even if the configure script fails to finish. The result is that the make command either fails or compiles the source code with a default setting the administrator didn't intend to use. To prevent this situation, always use the command-line And operation, which ensures that each command runs only if the preceding command succeeded:
# ./configure && make
The make command will compile the software but won't install it. After the software is compiled, run the make install command to install the software files, including libraries and documentation, to the required location:
# ./configure && make && make install
Uninstalling source-based software. The major caveat to managing software installed by source is that you'll find it laborious if not impossible to remove the software. Most software installed by source is installed to various locations under /usr/local. It can be difficult to determine where files were installed and whether newer versions were installed over older versions. (Package managers, which I address later, effectively address the challenge of removing software.)
If you're lucky, the developer will include an uninstall option in the Makefile you use to originally install the software. The following example removes source code by using the uninstall directive with the make command:
# make uninstall
Some developers use a deinstall directive instead of an uninstall directive. If the uninstall directive fails, try
# make deinstall
If both fail, you'll probably have to delete each installed file manually or leave the software on the system. To determine which files were installed, you can examine Makefile by using a text editor, which is tedious at best.
You can track which files are installed by source or altered by a source-based installation one of two ways. The first is to use a file integrity tool, such as Tripwire's Tripwire for Servers (http://www.tripwire.com), to track file changes on the server. In any case, you should deploy file-integrity tools enterprisewide to increase your ability to monitor file systems for unauthorized changes. The second is to use a software manager, such as GNU Stow (http://www.gnu.org/software/stow) or Depot (http://asg.web.cmu.edu/depot). These tools work like package managers to monitor which files are changed by source-based installations and to help automate software removal.
Installing by Using a Package Manager
Although installing by source permits a lot of customization, package managers offer a more administrator-friendly installation method. Linux distribution vendors provide package managers that, like Windows Installer, automate most of the software installation management task.