-->
Previous Table of Contents Next


Using make with Apache Software

When you obtain the Apache software, you may have it in source code form only and not compiled for your system. Some CD-ROM versions of Linux do include pre-compiled versions of Apache, so you don’t have to worry about this step if that’s the case. If you download from an FTP site or a Web page, though, you’ll most likely have to compile the software yourself. This isn’t a major problem, though, because the entire process has been automated with a utility called make. We look at the make utility in a lot more detail in Chapter 56, “Source Code Control,” but you don’t need to know too much detail to follow this section.

First, let’s make sure the Apache software is ready to go. If you have downloaded the file, you’ll have a single compressed file (most likely called apache.tar with either a .Z or .gz extension. Copy the file to a temporary directory (any directory name will do). You can unpack the file with one of these two commands:


uncompress apache.tar.Z

gunzip apache.tar.gz

depending on the extension of your file. (We looked at the compression systems used by Linux in Part II, “Getting to Know Linux” and Part VI, “Linux for System Administrators.”)


TIP:  
If you are using the GNU tar version (which is included with most Linux systems) you can uncompress and untar with the single command:

tar zxvf apache.tar.gz


After the file has been uncompressed it will be called apache.tar (or the same name as the compressed file without the .Z or .gz extension; we’ll use apache.tar as the example throughout this section but you should substitute the real filename if it differs, of course). The tar file contains all the files needed by Apache and has to be untarred using this command:


tar xvf apache.tar

This will unpack the tar file and leave a whole bunch of separate files, mostly lowercase but a few with uppercase names like README. The README file tells you how to compile Apache when you are ready. Before compiling, you have to make sure the system is properly configured for your hardware and software. This is done through the Configuration file, which must be edited with an ASCII editor.

The Configuration file is a little awkward. There’s a lot of subtlety and power in the Configuration file, most of which is much too complicated to explain in a section like this. Luckily, most of it you’ll likely never need. The Configuration file is used by a special script called Configure, which generates a file called Makefile used by the make utility to compile Apache. There are four kinds of lines in this file:

  comments—any line starting with # is a comment.
  commands for make—lines that start with nothing.
  modules—any bunch of lines that start with the keyword Module.
  rules—any line that starts with the word Rule.


TIP:  
Don’t directly edit the Makefile file. Any changes you make to this file are overwritten and lost when you run the Configure script. The Makefile is generated automatically by the Configure tool by reading all the lines in the Configuration file.

In almost all cases for Linux, all you need do with the Configuration file is remove comment symbols from some lines or add them to others. All the rules and modules can be ignored until you get into tweaking the system. If you look at the Configuration file you’ll see that most of the comments lead into a Module section. These comments can be removed to trigger the inclusion of that Module during the Makefile generation. The standard version of Apache for Linux has all the right choices already selected for you, but you can read through the Configuration file and see what the different options are.


TIP:  
While there is little harm in uncommenting most sections in the Configuration file, there are three you should leave commented. The cern_meta_module is used for backward compatibility with an old CERN server. The dld_module is used for dynamic-link loading of code and is not supported by Linux. Finally, msql_auth_module is for SQL management of large user password files and is essentially useless unless you are running Minerva SQL.

To start the generation of the Makefile from Configuration, you need to issue the Configure command (note that the uppercase letters are usually specific and must be typed if they appear that way when you do a directory listing). To run Configure, make sure you are logged in as root and simply type the utility’s name:


Configure

You’ll see a few messages, most likely just these two:


Using Configuration as config file

Configured for FreeBSD platform

Your second line may be a little different, depending on the version of Apache you obtained. To finish the process, you need to invoke the make utility (which depends on you having installed the C compiler and utilities):


make

By default, make looks for a file called Makefile and runs that. You may get error messages or simple status messages from the compiler (assuming it can be found), and then you’ll get your shell prompt back. The end result of all this is a single executable file called httpd, which is the HTTP daemon. If you tried to run the httpd program, you may get a message that a file is missing. The file httpd is complaining about is the Apache run-time configuration file (usually called httpd.conf).


Previous Table of Contents Next