HomeApache Page 3 - Getting Started with Apache 2.0, Part 1
Compiling Apache - Apache
In this first article in a three-part series, Harish Kamath helps you download and configure the Apache Web server. If you've wanted to use PHP with Apache, look no further; that part of the setup is also covered here.
Now that you've downloaded the source code from the Apache website, it's time to start up your Linux console and fire these commands, one-by-one.
$ cd /usr/local/src/
$ tar -xzvf /tmp/httpd-2.0.52.tar.gz
This should create a directory named "httpd-2.0.52" with all of the required files. At this stage, I'll concentrate on the "default" configuration of the Apache Web server, which is sufficient for driving a website consisting of static pages and basic CGI requirements.
I'm pretty sure that most of our readers wish to run PHP scripts on their Apache-driven Web servers. But, there is no reason to panic - later, I'll also show you how to install PHP version 5.0 and configure the Apache Web server to execute your PHP scripts.
Coming back to the compilation of the Apache source code - navigate to the location where you have unzipped the downloaded archive file and execute the "configure" script, present therein. Here, I have used only one configuration option, i.e. the "--prefix" option. This option allows you to specify the location where you would like to the install the software on the server.
$ cd /usr/local/src/httpd-2.0.52/
$ ./configure --prefix=/usr/local/apache
Behind the scenes, this "configure" script does a quick check in order to ensure that the settings in the configuration files, to be created later, reflect those of your server. Note that you can always review the contents of the "config.log" file (if generated) in order to investigate any errors that you may have encountered.
Once the "configure" script completes execution, the Apache Web server is now ready for installation. The next step: you'll need to run the "make" command, as shown below.
While the output of this command does appear daunting (especially for newbies) at first glance, please be assured that all is well - the only time to hit the panic button is when the command stops abruptly with an error message.
The final step: run the "make install" command:
$ make install
Once again, you are subjected to a screen full of cryptic statements. But, if you get to see a final message that looks something like this - make: Leaving directory `/usr/local/src/httpd-2.0.52' - you can afford to give yourself a little pat on the back because you have successfully installed the Apache Web server. Now, it's time to test the installation - start up the Web server using the following command:
$ /usr/local/apache/bin/apachectl start
$ lynx http://localhost
and fire up lynx (or any other Web browser) to navigate to the default location, as shown above. If you are able to view the "Test Page for Apache Installation," you can pop the champagne bottle because your Web server is now ready to serve static HTML websites.