Home arrow Apache arrow Page 4 - Getting Started with Apache

Installing Apache from Prebuilt Packages - Apache

Learn the basic steps necessary to download, install, and configure a basic Apache server. This article is from chapter two of Pro Apache by Peter Wainwright. (Apress, 2004, ISBN: 1590593006).

  1. Getting Started with Apache
  2. Installing Apache
  3. Installing Apache from Binary Distribution
  4. Installing Apache from Prebuilt Packages
  5. Installing Apache by Hand
  6. Upgrading Apache
  7. Basic Configuration
  8. Administrator’s E-Mail Address
  9. Starting, Stopping, and Restarting the Server
  10. Generic Invocation Options
  11. Windows-Specific Invocation Options
  12. Testing the Server
  13. Testing the Server Configuration Without Starting It
  14. Using Graphical Configuration Tools
By: Apress Publishing
Rating: starstarstarstarstar / 19
December 13, 2004

print this article



If you’re using an operating system for which a prebuilt Apache package is available, you can often save time by installing one package instead of installing individual files from a binary distribution. However, packages may lag behind the current Apache release—whether or not this is important depends on whether you need specific features or bug fixes only available only in the latest release.

Administrators interested in building Apache from source but who also want to retain the benefits of upgrading Apache as a package may be interested in the ability of more recent Apache 2 distributions to build an RPM package directly out of the source distribution, providing the best of both worlds.

Prebuilt Unix Packages

Most distributions of Linux and FreeBSD come with Apache as standard, so for these operating systems all of this has already been done for you. If not, you can locate an RPM package (Red Hat, Caldera, and SuSE all use this format) or deb (for Debian) from http://rpmfind.net/ or http://www.debian.org/, respectively.

The following example uses an Apache 1.3 RPM, but Apache 2.0 is just the same. First, if the RPM is signed, verify it with:

$rpm -verify apache-1.3.28-1.i386.rpm

This will carry out any possible MD5 or PGP checks, depending on the source of the package. Assuming it checks out, the installation command is typically of this form:

$ rpm -ivh apache-1.3.28-1.i386.rpm

Here the -i option is the only essential one—it means “install,” -v produces more verbose output, and -h generates a progress bar.

Note that you need to have root privileges to carry out this installation. To install into a different location, you can usually use the --relocate option, which takes the installation root in the package and remaps it to a new location. This may or may not work depending on the package. For example, for a package that normally installs Apache under /usr/local/apache, you would use something like this:

$ rpm -ivh apache-1.3.28-1.i386.rpm --relocate

If you expect to be building any third-party modules, you should also install the apache-devel package (or httpd-devel for Apache 2). This contains the include files and the apxs utility, among other files:

$ rpm -ivh apache-devel-1.3.28-1.i386.rpm

You can install both files at the same time simply by listing them both on the same command line.

To find out where Apache has been installed after the event, list the files using this:

$ rpm -qlp apache-1.3.28-1.i386.rpm

Here -q puts the rpm utility into query mode, -l tells it to list the files for a package, and -p tells it to use the file specified on the command line rather than look for a package with the same name already installed on the server.

Depending on how Apache has been packaged, you may also have supplementary packages to install. For example, the RPM build specification file included in recent Apache 2 distributions divides Apache into httpd, httpd-manual, and httpd-ssl packages.

If you’re upgrading an existing installation, use -U instead of -i. Existing configuration files will be preserved, usually by being renamed with an .rpmsave extension:

$ rpm -Uvh apache-1.3.28-1.i386.rpm

If you want to use tools such as apxs to build third-party modules, you need to install the apache-devel package. In some distributions—for example, Red Hat—the Apache manual is also packaged separately as apache-manual because if you have ready access to the Apache Web site, you can omit a locally installed manual. To install these, use this:

$ rpm -ivh apache-devel-1.3.28-1.i386.rpm
$ rpm -ivh apache-manual-1.3.28-1.i386.rpm

This is all you need to do to install Apache. Scripts will automatically be installed so Apache starts and stops with the operating system. In most cases, a new user and group will be created for Apache to run under as part of the installation process. In some cases, the server will even be started automatically, and you can point a browser at http://localhost/ to see your new Apache server running. To see where Apache was installed, including all the additional support files and startup scripts, use this:

$ rpm -ql apache

This tells rpm to list the files for the installed copy of Apache, so don’t use the complete package filename. For more information on RPM, including how to perform package integrity checks and force relocation, see the RPM manual page.

Prebuilt Windows Packages

You can find Windows self-installing packages at http://www.apache.org/dist/httpd/binaries/win32/. Microsoft Installer (MSI) packages are also available. These need to be installed using Windows installer, which is bundled with Windows ME, 2000, and XP. Older Windows versions may download it for free from http://www.microsoft.com/downloads/. The MSI package is recommended because it’s both smaller and, because it uses the operating system’s own installation tool, more tightly integrated with Windows.

Assuming you choose the MSI package, you should first verify that it’s a genuine and untampered-with copy of the Apache server distribution. This is an optional step, but an important safeguard if the server is at all public. You can do this by verifying the MD5 checksum or PGP signature of the file by downloading them from httpd.apache.org and checking them against the file. As this is the same process used to verify source distributions, I cover both MD5 and PGP in “Verifying the Apache Distribution Archive” in Chapter 3. (Official Linux distribution RPM packages are similarly signed by their distributors, and you can use the --verify option of rpm to check their integrity.)

Once the MSI package is verified, you can install it simply by double-clicking the file icon. The installer provides a GUI during the installation process that’s the familiar Windows installation wizard. Before going too much further, you may want to glance through the rest of this chapter, especially paying close attention to the “Decisions” section.

Click the Next button to proceed with the installation because this screen simply confirms that it’s the Apache server being installed. On the next screen, a software license agreement is presented. Once you accept the license terms and click the Next button, some more reading material will be presented that describes what the Apache server is. Next, you’ll see a screen that requests a few installation parameters. The items to be filled in include the domain name, the server name (which is the hostname plus the domain name), the administrator’s e-mail address (which can be in a completely different domain if necessary), and finally a choice of binding the server to port 80 or port 8080.

Port 80, as you may remember from previous discussions, is a privileged port and the default for HTTP requests, meaning in Unix it’s below port 1024 and only root can bind a listener to it. Apache treats this the same way under Windows, but the distinction is largely symbolic because Windows doesn’t impose such restrictions. Port 8080 is used, again like Unix, to be bound in user space and therefore doesn’t need to have the service started by the administrator or at system start, so an unprivileged user can start the server. This choice is also good if Apache must coexist with another Web server such as Internet Information Service (IIS). Be warned, however, that choosing a port other than 80 will result in Apache having to be started manually.

After clicking the Next button, you’re prompted to select the setup type, either Typical or Custom.

Usually you would select a Typical setup, which performs a default installation without further prompting. It installs everything except the source distribution and uses defaults for all options.

More advanced users may select the Custom option to customize the installation. This allows you to select the features that the Apache installation will have and, more importantly, the folder in which Apache is installed. By default, Apache 2 is installed in the \Program Files\Apache Group\Apache2 folder. If you want to install Apache in a different folder, you can either select the Custom option or make the change in the wizard screen immediately prior to commencing the installation. The Custom option also allows you to specify the Start menu item name for Apache; the default name is Apache Web Server.

By specifying a different installation root and menu name, any number of Apache installations can be placed on the same server. Having said this, it’s not necessary to install Apache multiple times in order to get multiple running instances of Apache. You can also use the -f and -D options to run several Apache processes in different configurations using the same installation, as you’ll see shortly. The installer finishes by copying all the necessary files and informs you when installation is complete. Apache is now ready to run.

During installation, the standard configuration files shipped with Apache are copied to the conf folder within the chosen installation directory. If you’re overwriting an earlier installation, there may be old configuration files in this folder. In this case, the new configuration files will not overwrite the active configuration but instead be copied with the extension .default appended to the filename; therefore, httpd.conf will be copied as httpd.conf.default.

After installation, you can integrate the new configuration with your existing one. The Apache installer will also avoid installing its default Web site if it detects that an existing Web site has been placed in the default document root.

NOTE This completes the installation. You’ll want to carry out some configuration at some point, but the server should now be ready to run, at least for testing purposes.

This chapter is from Pro Apache by Peter Wainwright. (Apress, 2004, ISBN: 1590593006). Check it out at your favorite bookstore today. Buy this book now.

>>> More Apache Articles          >>> More By Apress Publishing

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Apache Unveils Cassandra 1.2
- Apache on ARM Chips? Dell and Calxeda Help M...
- The Down Side of Open Source Software
- VMware Unveils Serengeti for Apache Hadoop
- SAP Takes Steps to Improve Hadoop Integration
- Looking to Hone Apache Hadoop Skills?
- How to Install Joomla on WAMPP
- Working with XAMPP and Wordpress
- GUI Available for Apache Camel
- Reduce Server Load for Apache and PHP Websit...
- Creating a VAMP (Vista, Apache, MySQL, PHP) ...
- Putting Apache in Jail
- Containing Intrusions in Apache
- Server Limits for Apache Security
- Setting Permissions in Apache

Developer Shed Affiliates


Dev Shed Tutorial Topics: