|Your Daily Source for Apache News and Information|
|Breaking News||Preferences||Contribute||Triggers||Link Us||Search||About|
This article will discuss how to build, install, and setup Apache 2.0. This procedure has not changed very much in the last few alpha releases, so although this technique may change during the beta releases, it should not change much. I will try to point out where this will most likely change in the future. All of these instructions will be Unix machines. Other platforms will accomplish these things differently. For most platforms, there are basic instructions included in the distribution. Between those instructions and this article, you should be able to get Apache 2.0 compiled and running.
Autoconf version 2.13 (won't be needed for release versions)
An ANSI compiler (won't be needed for binary release packages)
Libtool 1.3.3 (won't be needed for binary release packages)
CVS or Rsync (Not strictly needed)
Apache 1.3 had two different configuration methods,
src/Configure. This caused more than a little confusion among people new to Apache. The Apache developers made a conscious decision early in 2.0 development to remove this confusion and create one configuration system based on Autoconf. Because Apache 2.0 is still in alpha, the packages do not include the actual configure script. Instead the packages include the files needed by Autoconf to build the configure script. When Apache 2.0 is released, the package will include the configure script, and Autoconf will no longer be required.
While we are in alpha, and possibly through the betas, the only distribution medium available for Apache 2.0 is a source package. If you download the source package, you will need a compiler. Apache has always used an ANSI compiler as the lowest common denominator. After Apache 2.0 is released, if you download the binary release, Apache will obviously not require any compiler.
Another problem that Apache 1.3 suffered from, was incorrectly compiling dynamic modules. This problem plagued Apache all the way through Apache 1.3.10. Compiling dynamic modules correctly is not a trivial task. For this reason, The Apache developers decided to focus on writing a web server, and let somebody else worry about compiling correctly. Libtool fits the bill perfectly. By using Libtool, the Apache developers can ignore compilation issues completely. After Apache 2.0 is released, it will be possible to download the binary release, and avoid the Libtool requirement.
There are four options for downloading the Apache 2.0 source. The first is to download the latest package from the Apache group. Whenever the Apache Group releases a new version, whether it be alpha, beta, or the final version, the group packages all of the source files together and places them on the web site. These packages can be found at http://www.apache.org/dist. The second method is to download the the CVS packages. The Apache Group has a script that packages the most recent source codes every six hours, and makes those available to the general public. Those packages can be found at http://dev.apache.org/from-cvs/apache-2.0/. The final two methods both get the most recent version of Apache 2.0. It is possible to get the source using either CVS or rsync.
To use Rsync, type:
user@host> rsync -avz dev.apache.org::apache-2.0-cvs apache-directory
To use CVS, type:
user@host> export CVSROOT=:pserver:email@example.com:/home/cvspublic
user@host> cvs login (password is anoncvs)
user@host> cvs checkout apache-2.0
I have tried to use Rsync, but I was unable to make it work. I will try to figure out what is wrong with Rsync before this article is released, but I suggest using CVS if Rsync doesn't work immediately. The complete instructions for extracting Apache in either of these two methods can be found at http://dev.apache.org/anoncvs.txt.
Each of these methods for getting the source code has advantages and disadvantages. The first method, getting the package that the Apache Group created, is the package that is most likely to compile and produce working code quickly. When the Apache Group releases an alpha, we try very hard to ensure that the package is working and is stable on most platforms. However, this is still an alpha so it is not intended to be used as a production server. This package is also likely to be out of date. Apache 2.0 development is progressing very quickly, even if you download the package the day after the alpha is released, there are likely to be one or two bug fixes or enhancements in the most recent code. The second method, the packages created every six hours, will always be more up-to-date than the official alpha releases. However, this code is extracted out of CVS, it is not tested at all to ensure that the code is stable or even working. The advantage to this method, is that no other tool is required to get the code. Finally, CVS and Rsync offer the most up-to-date code. However, again this code is unlikely to work.
Which method you choose to get the source code will depend on why you are getting it. If you are a developer who wishes to help move Apache 2.0 along, or who wishes to write or port a module to 2.0, then using either CVS, Rsync, or the packaged cvs tree will provide you with the code most like what will become the Apache 2.0 release. If you are just interested in playing with Apache 2.0, and don't need the most up-to-date code, then the alpha packages will provide the most stable code.
Once you have downloaded the Apache 2.0 tree, the next step is to configure it so that you can build Apache 2.0. This is a two step process. The first step creates the configure script from the Autoconf source files. The second step actually configures the source tree. For the rest of this article , we will assume the source tree has been extracted to
To build the server do the following:
user@host> cd ~/apache-2.0/src
user@host> ./configure [--prefix install-dir] [--with-mpm=MPM]
The first step,
./buildconf, creates the
./configure script. This script finds all of the config.m4 files in the Apache tree, and creates the
Buildconf also runs Autoconf and Autoheader on the
configure.in file. Autoconf creates the
./configure script, and Autoheader generates the
include/ap_config.h.in file. This file is used in the next step to help configure Apache 2.0. After creating the top-level configure script,
Buildconf switches to the APR subdirectory, and runs its
Buildconf script. This script runs Autoconf and Autoheader on APR's
configure.in file. This creates a second
./configure and a new file,
src/apr/include/apr_private.h.in. These files are also used in configuring Apache. Finally, APR's
buildconf script switches to the
src/lib/apr/shmem/unix/mm subdirectory and runs autoconf in this directory. This creates MM's
./configure script, which is the final subconfigure script used configuring the Apache server.
The second step actually configures the server. I have included the most common arguments to
./configure, but there are many more. To determine what all of the arguments are, run
./configure --help. This will provide a list of all of the arguments and a little documentation about each argument. There is not much more documentation, but it will be written before Apache 2.0 is finally released. The two arguments detailed above determine where Apache will be installed and which MPM will be compiled. There is one other argument that is very useful for developers, "
--with-maintainer-mode". This argument configures Apache to use very restrictive settings when compiling Apache.
To build Apache, run
make;make install. This is self explanatory. The first step builds Apache, and the second installs it into the directory specified in the configure command.
When Apache is installed it is a full installation. This includes a sample configuration file and an index.html file in multiple languages. To test that everything is working, we can now start Apache 2.0 and request a page. The default configuration uses port 80, which means you can only start Apache if you are logged in as root and you have no other web server running on this machine. To change this, change to the directory where Apache 2.0 has been installed and edit the file
conf/httpd.conf using your favorite editor. Search for the string:
Change the default Port to some value higher than 1024. Save the file and exit the editor. Next run:
This is slightly different than Apache 1.3. In Apache 1.3 a script called
apachectl was automatically installted. This script was able to start, stop, and restart the server. This script has not been written yet for Apache 2.0, so we have to start and stop the server manually. The
apachectl script will be included with the final Apache 2.0, and may be included with the next alpha or one of the beta versions.
The server should have been started now. You can determine this by checking the
logs/httpd.pid file. If this file is there, the server has been started. If it isn't there, check the error log,
logs/error_log. If there is a problem, this file is your best chance to diagnose the problem.
As long as the server started, we can request a page. Pick your favorite Web browser and make the request
http://localhost:PORT, where PORT is the value you specified above. The page that is returned should be the index for the
htdocs/ directory. The default index page is
index.html, but Apache does not install this file. Apache installs twenty-five
index.html files, each in a different language. Because Apache 2.0 does not turn Mutli-views on by default, the default configuration can not determine which file to use as the index page. To see the default start page in English, request
Setting up Apache 2.0 is very much like setting up Apache 1.3. Everything is controlled by the
httpd.conf file, which is plain text. There are very few differences, but the differences are important. The biggest difference is the number of
<IfModule ...> directives in the default 2.0 configuration file. This is important, because there is a different
<IfModule> container for each MPM. Different MPMs have different configuration directives, so this is important. Current Apache 1.3 configuration files will only work with 2.0 if it is configured to use the Prefork MPM. All of the other MPMs have different configuration directives, and they remove some of the old 1.3 directives. The directives that are implemented by the Prefork MPM are listed in the configuration snippet below. If Apache 2.0 is configured to use the MPMT_Pthread MPM then the other directives listed below are implemented:
Hopefully after this article you will be able to download and install Apache 2.0. With a little work, it should also be possible to migrate an existing Apache 1.3 installation to an installation of the latest 2.0 alpha. If you are interested in getting a jump on Apache 2.0, there is no better time than now to jump in.
|About Triggers||Media Kit||Security||Triggers||Login|
All times are recorded in UTC.
Linux is a trademark of Linus Torvalds.
Powered by Linux 2.4, Apache 1.3, and PHP 4