< Day Day Up > |
Recipe 22.2. Installing Apache 2.0 from Sources22.2.1 ProblemYou want to install Apache 2.0 from sources, so that you can customize it exactly the way you want. That means you need to know the configure options, and what modules are available. You also want to take advantage of DSOs (Dynamic Shared Objects), so you can add or remove modules later without having to recompile the httpd binary. 22.2.2 SolutionApache 2.0 installs via the usual configure-make-make install routine. However, it has a large of number of compile-time options, so you'll spend some time selecting the ones you want. You'll also need to know the defaults. The configuration below shows a typical installation. First, download and unpack the Apache tarball. (The current stable version is httpd-2.0.50.) Next, make a list of all the files on your system: # find / | grep -v -e ^/proc/ -e ^/tmp/ -e ^/dev/ > apache2-preinstall.list You'll also make a post-install list, so you can diff the two lists and see exactly what files Apache installed. Change to the directory where you unpacked the tarball, and display all the configuration options: # ./configure —help | less The default is to put everything in /usr/local/apache2. This configuration puts things in more standard locations, and modifies the default modules slightly: #./configure —prefix=/etc/httpd \ —exec-prefix=/usr \ —bindir=/usr/bin \ —sbindir=/usr/sbin \ —mandir=/usr/share/man \ —sysconfdir=/etc/httpd/conf \ —includedir=/usr/include/httpd \ —libexecdir=/usr/lib/httpd/modules \ —datadir=/var/www/ \ —with-mpm=prefork \ —enable-mods-shared="rewrite" \ —disable-cgi Now run make and make install: # make # make install Then make another list after installation: # find / | grep -v -e ^/proc/ -e ^/tmp/ -e ^/dev/ > apache2-postinstall.list Now start up Apache: # apachectl start And open the default web page by entering http://localhost in your browser. It should look like Figure 22-1. Figure 22-1. Default Apache web pageYou now have a working web server. 22.2.3 DiscussionIf you don't want to add any DSOs during configuration, but you want to enable DSO capability for adding modules later, use this line in ./configure: --enable-so There is no downside, except using more disk space, to building all available modules at installation. Adding or removing them is then as simple as editing httpd.conf, then restarting Apache (see the next recipe). To build all modules at compile time, do this: --enable-mods-shared=all There are many RPMs and .debs for Apache, so you may install from packages if you prefer. A rather large problem you will encounter is that the various package maintainers use all kinds of different filenames and have their own ideas as to where Apache's files should go. This isn't too awful if your Linux distribution provides good documentation, like Red Hat and SuSE do. But if you don't have good localized documentation, you're going to spend a fair amount of time just trying to find things. If you run ./configure again with new settings, be sure to run make clean first, or your old configs will still be hanging around, getting in the way. The above configuration does these things:
LoadModule rewrite_module /usr/lib/httpd/modules/mod_rewrite.so
22.2.4 See Also
|
< Day Day Up > |