Building your Linux apps from source

The idea of building applications from source is foreign to Windows and commercial software users, but it is really not as scary as it sounds. Recently, I was called upon to install and configure Apache, MySQl and PHP on a client’s RedHat 9 installation. They were keeping their Redhat 9 machine up to date using the yum legacy program, but the legacy repositories are not always up on the latest editions. After all, volunteers maintain these, too.

As the client’s requirements included a need for transactions, the InnoDb database engine was a good choice. PHP supports a new MySQL interface in PHP 5.0.3 which takes full advantage of the new features in MySQL 4.1.x, so I chose to build Apache, MySQL and PHP from source. A little Googling came across several useful sites, where other developers had posted the commands they used to do this. Two I found especially useful:

  • http://dan.drydog.com/apache2php.html
  • http://hulan.info/blog/item/compile-from-source-apache-2-0-52-with-ssl-php-5-0-2-and-mysql-4-1-6-on-linux

Building from source involves a few steps:

  1. Download the source, typically from the main project web site or a trusted mirror. A good place to store all the files is /usr/local/src.
  2. Unpack the files into their own directories, typically with tar -zxvf for a tar.gz (“tarball”).
  3. Hop into that directory and take a quick read through INSTALL, README, LICENSE and CONFIGURE files to see if there are any gotchas.
  4. Build the script that does the compile (a “makefile”) with ./configure. If you followed the links above, you can see ./configure may have many options. Adding –help after ./configure will list them, and a little research can tell you the ones you want. If you get errors during this step, it’s back to the forums, Google or the instructions to determin if there’s more you need to do.
  5. Now that you’ve created the makefile, you invoke it with the command ‘make.’
  6. Install your application with ‘make install.’

It still sounds like a chore, but the end result is a working application that you have tuned to your system and needs, up to date with the latest source you could obtain, and installed where you want.

, ,

No comments yet.

Leave a Reply

Powered by WordPress. Designed by Woo Themes

This work by Ted Roche is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States.