Installing Apache 2.2.4
Working for various clients and deploying a full working rails stack on their hardware and environments is not always as straight-forward and easy as it should be. What distribution are they using? Which package manager? Does the package manager even currently have the right versions I need? So over the coming days I'm going to write a few tutorials on getting the latest software, from source, and compiling it. So intro today, with Apache.
The only assumption I make is that gcc is available on the system so the we can compile the source into binaries. If you don't have it, you'll need to install it for your system. So the first thing to do is download the latest unix source from a local mirror and save it somewhere convenient. To make life easier, I'm going to download all the files directly to the server using wget. So it's simply a matter of:
mkdir rails-setup cd rails-setup wget http://www.apache.org/dist/httpd/httpd-2.2.4.tar.gz
<p>But before we get too far ahead of ourselves, I know that I'm going to want to add in the ability to compress output I'm sending back to the end user, as well as support for <span class="caps">HTTPS</span>/SSL. So I'm going to need those libraries too. Lets go get them:</p>
And tada! We've hopefully got all we need. Time to compile.
wget http://switch.dl.sourceforge.net/sourceforge/libpng/zlib-1.2.3.tar.gz wget http://www.openssl.org/source/openssl-0.9.8e.tar.gz
tar zxf zlib-1.2.3.tar.gz cd zlib-1.2.3 ./configure --prefix=/usr/local make; sudo make install; make clean; cd ..
<p>So what have we just? We've grabbed the <a href="http://www.zlib.net/">zlib</a> tarball and extracted and decompressed it into it's own directory. We then go in there, and run <em>./configure</em> to ensure it is setup for our environment. Then we run make, install it once it's done, and then clean up the leftovers.</p> <p>Time to do the same with <a href="http://www.openssl.org/">OpenSSL</a>.</p>
tar zxf openssl-0.9.8e.tar.gz cd openssl-0.9.8e ./config --prefix=/usr/local make; sudo make install; make clean; cd ..
<p>Okay, now we should be ready for Apache. Here's the next series of commands I typically run:</p>
tar zxf httpd-2.2.4.tar.gz cd httpd-2.2.4 ./configure --enable-mods-shared=all --enable-proxy --enable-proxy-balancer --enable-proxy-http --enable-rewrite --enable-cache --enable-headers --enable-ssl --enable-deflate --with-included-apr --with-ssl=/usr/local/ssl --prefix=/usr/local/apache2 make; sudo make install; make clean; cd ..
<p>So what we've done is run the configure script to set things up for the current environment, letting make know that we want to enable</p> <ul>
It will then run through, compile all the code, install it on the server, and clean up it's mess it might have left behind.
<p>And there you have it! Apache is setup, and should be working and running on your server. Over the coming days I'll post further instruction on getting the rest of the stack running. That is going to entail MySQL and/or Postgres, ruby, rails, mongrel, mongrel_cluster, and monit for managing the services and starting/stopping everything. And of course, the various configuration that is required to make it all talk together.</p> <p>You could also delete the files we downloaded and the directories we installed from because our work here is done. I personally keep them around at least until everything is working together and the system is stable, but it's up to you.</p>