
This week we’ll actually be moving onto installing some software to run our server. This series will go over setting up a basic LAMP stack, which includes Linux, Apache, MySQL and PHP. Today we’ll be going over installing Apache. We will be compiling this software from source instead of using an automated installer such as yum. We’re doing it this way because compiling from source gives you more customizability and it is a great learning experience for managing your server.
Okay, start out be logging into your server and changing your directory to /. Now, we need to start out be downloading Apache to our web server. First head on over to Apache’s download page and copy the URI for the .tar.gz UNIX Source download under the latest version of Apache 2.2. Now, in your SSH client:
wget URL_TO_APACHE_DOWNLOAD
Replace URL_TO_APACHE_DOWNLOAD with the URL you got on the download page. Now, we need to extract the contents of the archive that gets downloaded:
gzip -d httpd-NN.tar.gz
tar xvf httpd-NN.tar
Replace NN with the version of the download (eg. 2.2.11). Now, change your working directory to the exatracted directory (again replacing NN with the version of the download):
cd httpd-NN
Now, we need to configure Apache to install with the modules we want installed. Here’s what I would start out with:
./configure --enable-so --enable-rewrite --enable-deflate
Which will allow Apache to work with modules (instead of having everything be complied into its core), install mod_rewrite and install mod_deflate. The full list of available configure options are available here. You can append more options to the line above. If you want to be able to enable and disable any of those options in Apache’s configuration file, you can append =shared to the end of the option (with no space before). This command may take a few minutes to execute.
Next, we get the configuration options prepared to be installed:
make
This may also take a couple of minutes. Now, we can actually install Apache, which we do by running this command:
make install
Assuming you haven’t encountered any errors, Apache should now be installed. We can start it by running this command:
/usr/local/apache2/bin/apachectl -k start
You should now be able to head over to the IP address of your server and see your server… serving! Alright, now since we’ll be controlling Apache quite a bit when managing our server, let’s make its command a little shorter.
cd /bin
ln -s /usr/local/apache2/bin/apachectl apachectl
Which will allow up to control Apache in this shortened form:
apachectl -k start
Conclusion
Because I want to keep these guides short, so as to not overload people with all this new information all at once, we’ll be discussing Apache’s configuration file in a later article.




