Red Hat Linux 7 Unleashed

Red Hat Linux 7 Unleashed

By William Ball

Server Installation

You can install Apache from RPMs or by building the source code yourself. The Apache source builds on just about any UNIX-like operating system, and also on Win32.

If you are about to install a new version of Apache, it is probably a good idea to shut down the old server. Even if it is unlikely that the old server will interfere with the installation procedure, shutting it down ensures that there will be no problems. If you do not know how to stop Apache, look at the section Starting and Stopping the Server later in this chapter.

Installing from the RPM

You can find the Apache RPM either on the Red Hat Linux installation media, on the Red Hat FTP server, or one of its many mirror sites. You will want to check the updates.redhat.com FTP site (or one of the mirrors) as often as possible. In the directory corresponding to your Red Hat version you will from time to time find updates for Apache. These can be important updates that fix bugs or security breaches. When an updated version comes out, you will want to install it as quickly as possible in order to be secure.

After you have obtained an Apache RPM, you can install it with the command-line rpm tool by typing the following:

					
   rpm -Uvh latest_apache.rpm
					
   
				

where latest_apache.rpm is the name of the latest Apache RPM.

For more information on installing packages with RPM, see Chapter 21, "Linux System Administration."

The Apache RPM installs files in the following directories:

When Apache is being run, it will also create files in the following directories:

Building the Source Yourself

There are several ways in which you can obtain the source code for Apache. The Red Hat distribution has SRPMs containing the source of Apache, which sometimes include patches to make it work better with Red Hat's distribution. The most up-to-date versionsare found at ftp://updates.redhat.com. When you install one of these SRPMs, a tar archive containing the Apache source will be created in /usr/src/redhat/SOURCES/. You can also download the source directly from http://www.apache.org/.

Once you have a tar file, you will need to unroll it in a temporary directory somewhere nice, like /tmp. This will create a directory called apache_ version_number, where version_number is the version that you have downloaded (for example, apache_1.3.12).

There are two ways to compile the source—the old, familiar way (at least, to those of us who have been using Apache for many years) and the new, easy way.

The Easy Way

To build Apache the easy way, just run the ./configure in the directory just created. You can provide it with a --prefix argument to install in a directory other than the default, which is /usr/local/apache/.

./configure --prefix=/preferred/directory/

This will create a file called Configuration in the src/ subdirectory. It also generates the makefile that will be used to compile the server code.

Once this step is done, type make to compile the server code. After the compilation is completed type make install to install the server. You can now configure the server via the configuration files. See the section Runtime Server Configuration Settings for more information.

The Advanced Way

If you want to do things the old-fashioned way, or you just want more control over the way that your server is built, follow these steps:

  1. In the source directory, copy the file Configuration.tmpl to Configuration and open up Configuration with your favorite editor.
  2. Modify the compiler flags if, and only if, you know what you're doing. Uncomment those modules that you would like included, comment out modules that you don't want, or add lines for custom modules that you have written or acquired elsewhere.
  3. Run the Configure script to create the Makefile.
  4. Finally, compile and install the server with make and make install.

File Locations After Manual Installation

As of version 1.3.4, all of the files are placed in various subdirectories of /usr/local/apache (or whatever directory you specified with the --prefix parameter). Before version 1.3.4, files were placed in /usr/local/etc/httpd.

The following is a list of those directories that are used by Apache, as well as brief comments on their usage.

  • /usr/local/apache/conf—This directory contains all the Apache configuration files, which include access.conf, httpd.conf, and srm.conf. See the section on configuration files later in this chapter.
  • /usr/local/apache— The cgi-bin, icons, and htdocs subdirectories contain the CGI programs, standard icons, and default HTML documents, respectively.
  • /usr/local/apache/bin— The executable programs are placed in this directory.
  • /usr/local/apache/logs— The server log files are placed in this directory. By default, there are two log files—access_log and error_log—but you can define any number of custom logs containing a variety of information. See the section on logging later in this chapter.

Share ThisShare This

Informit Network