Delicious Bookmark this on Delicious

Computer Forums

Installing an Apache server on Linux - Compiling from Source - Compiling Apache source code on Linux



0) Before compilation can be done, you must place yourself at the root of the httpd-2.2.19 folder which was just unzipped. In order to do this, run the command:

cd /home/Username/Desktop/httpd-2.2.19

N.B.: don't forget to replace "Username" with the name of your home folder :)

1) Open the Linux Terminal window, and configure the makefile by specifying the folder where your Apache server shall be installed (the ServerRoot, in this example, will be the httpd-2.2.19 folder which is already on your desktop and contains all the source files; if you wish, you can create another empty folder within wich to install Apache; in this case, you will need to modify the path below accordingly):

$ ./configure --prefix=/home/Username/Desktop/httpd-2.2.19

2) Compile the Apache server with the default modules (we will see later how to choose the modules you want to compile; note that you will do just fine with the default Apache modules for the sake of this example. If nonetheless you want to compile your own modules now, see below "Compiling the Apache modules of your choice")

$ make

3) Install the Apache server

$ make install

Congratulations ! Your Apache server has just been compiled and installed into to the Apache directory on your desktop.

Computer Forums

Installing an Apache server on Linux - Compiling from Source - Testing you Apache server



In order to verify that your Apache server is running correctly, please run the following command in the terminal window:
sudo /home/Username/Desktop/httpd-2.2.19/bin/apachectl start (do of course substitute "Username" with your own username, etc ...)

You will probably be greeted with the following error message:
"httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName".


This is alright since we haven't configured the apache server yet (it is thus assuming default parameters). If you want to remove this error message, edit the /home/Username/Desktop/Apache/conf/httpd.conf file by setting the ServerName parameter at 127.0.1.1. We will see later how to fully edit the http.conf file.

A couple of remarks:
  • In order to start the Apache server, you must call apachectl start via the full path above (do not try to simply call "apachectl start" as it may fail since the command is not part of your $_PATH environment)
  • apachectl start (resp. apachectl stop) are not supposed to return anything indicating that the Apache server has been started (resp. stopped). If it doesn't return any message, then assume it's working. In order to be sure that it did start/stop your server Apache as expected, add a file index.html in the public html folder located at /home/Username/Desktop/httpd-2.2.19/htdocs. Then point your browser to the URL http://localhost/ and see whether the index.html file is displayed as expected
Apache Server started
Computer Forums

Next tutorial: Installing an Apache server on Linux - Compiling the Apache modules of your choice


Back to computer forums