Compiling Software from Source

Most software comes in the form of RPM packages, which are easy to install. In some scenarios, however, it will be necessary to install software from source files because no RPMs or other easy-to-install formats are available. This software has to be compiled first. Fortunately, most programmers that deliver software in source packages use a uniform installation procedure. The software is distributed in a tar archive that is often zipped.

Caution Be careful with what you install. Installing source files may cause you to lose your support on SUSE Linux Enterprise Server.

Follow the next steps to install and compile the software. In the example, you will learn how to install the tool.tgz software:

1. To install software from the sources, you need a C compiler. Make sure this compiler is installed before proceeding.

2. Download the distribution of the source file packages to your home directory.

3. Use tar to extract and unzip the packaged software. Assuming that the name of the package is tool.tgz,you would do this with the command tar zxvf tool.tgz. In most cases, this will create a subdirectory with the name of the package (tools/ in this case) in your current directory. Activate this directory with the cd command.

Tip You don't want to end up with hundreds of source files after extracting the .tgz file that contains the software you want to install. Before extracting, it is always a good idea to use tar with the t option (tar tzvf tool.tgz,for example) to see what is inside. If you see only filenames without a directory name, put the .tgz file in a temporary directory, and extract it from there.

4. In the directory where your software has been installed, you will almost certainly see a file with the name configure. If you see it, execute it with ./configure (don't forget the ./ before configure!). If you don't see it, check whether there's a document called README, INSTALL, or something similar, and read it for specific instructions before proceeding. If the ./configure command did work, your system will be preconfigured to perform a successful installation of the source files.

5. Now you need to compile the software. Fortunately, you can use the make command. This command executes the Makefile, which you will normally find in the directory containing the source files. In this Makefile, all instructions are listed that have to be executed in order to compile the software. The alternative would be that you have to enter all the gcc compiler commands yourself, and as you can see, although the make command does its job, this can be quite a challenge.

6. Working as the root user, you need to make sure that all the software components that have just been compiled are copied to the right location on your server. To do this, use the make install command. This is the only command in this procedure that you really must issue as root.

Was this article helpful?

0 0

Post a comment