Home / Blogs / shyam's blog
Installing Apache 2.2.10, PHP 5.2.6, MySQL 5.2.1, Mod_Python, PostgreSQL 8.3, Nginx, & CouchDB on OS X
About a year ago, I had moved to a Macbook Pro and had to set up my development environment on it. It was far from straight forward and involved a bit of work.
A year on from that time, I have moved laptops again and this time I have a Macbook and OS X Leopard Version 10.5.5 and there is a world of a difference out there.
I am not sure whether it was something that I was previously doing wrong or if the packages are now being better maintained towards OS X, but compilation and installation has been a breeze this time.
The only thing that I had installed before I got started was Xcode from the install DVD.
If your Xcode package is not the latest and greatest, do get to the Apple Developer Connection and grab it.
The list of software we will finally end up is something like this:
- Apache (2.2.10)
- mod_python (3.3.1)
- MySQL (5.5.1.29-rc)
- PostgreSQL (8.3.5)
- Memcached (1.2.6)
- PHP (5.2.6)
- CouchDB
All the packages are installed in such a manner that they are installed into /usr/local/{software-name}-{version}, from which it is symlinked to /usr/local/{software-name}.
This will enable us to keep track of all the package versions and also switch between the versions in case of any trouble.
Time to start the process:
Apache
Get the the source from Apache's website:
Untar, change into the source directory.
$ ./configure \
--prefix=/usr/local/httpd-2.2.10 \
--enable-cache \
--enable-disk-cache \
--enable-mem-cache \
--enable-dbd \
--enable-deflate \
--enable-cern-meta \
--enable-expires \
--enable-headers \
--enable-ident \
--enable-usertrack \
--enable-unique-id \
--enable-ssl \
--enable-rewrite \
--enable-so \
--enable-dav
$ make
$ sudo make install $ sudo ln -s /usr/local/httpd-2.2.0 /usr/local/apache2
mod_python
Get the the source from the mod_python site. Ensure it is the right version for Apache 2.x.
Untar, change into the source directory.
$ ./configure --with-apxs=/usr/local/apache2/bin/apxs
$ make
$ sudo make install
Edit httpd.conf to activate the modules:
$ sudo vi /usr/local/apache2/conf/httpd.conf
Add the LoadModule directive
LoadModule python_module /usr/local/apache2/modules/mod_python.so
Add the AddHandler directive in the <directory> block
AddHandler mod_python .py PythonHandler mod_python.cgihandler PythonDebug On
Restart Apache and test it with a couple of Python scripts in the document root.
MySQL
Get the the source from the MySQL site.
Untar, change into the source directory.
$ ./configure --prefix=/usr/local/mysql-5.1.29-rc
$ make $ sudo make install $ sudo ln -s /usr/local/mysql-5.1.29-rc /usr/local/mysql
PostgreSQL
Get the source code from the PostgreSQL website.
Untar and change to the source directory.
$ ./configure --with-prefix=/usr/local/postgresql-8.3.5 $ make $ sudo make install $ sudo ln -s /usr/local/postgresql-8.3.5 /usr/local/postgresql
Memcached
First, install libevent, which is a memcached dependency
Get libevent source code from here.
Untar and change to the source directory
$ ./configure $ make$ sudo make install
Get Memcached source code from Danga's website.
$ ./configure --with-prefix=/usr/local/memcached-1.2.6 $ make $ sudo make install $ sudo ln -s /usr/local/memcached-1.2.6 /usr/local/memcached
PHP
$ ./configure \ --prefix=/usr/local/php-5.2.6 \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-openssl \ --with-zlib \ --with-bz2 \ --enable-calendar \ --with-curl \ --with-pcre-dir \ --enable-ftp \ --with-mysql=/usr/local/mysql \ --with-mysqli=/usr/local/mysql/bin/mysql_config \ --with-pear \ --with-xsl \ --with-pgsql=/usr/local/postgresql
$ make $ sudo make install $ sudo ln -s /usr/local/php-5.2.6 /usr/local/php
Copy over php.ini to the install directory
$ sudo cp php.ini-dist /usr/local/php/lib/php.ini
If you wonder where the PHP binary has gone missing, check this link to get the right instructions.
Install the PHP Memcache client
$ sudo ./pecl install memcache
Enable it in php.ini by adding the line:
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/memcache.so;
Restart Apache
Nginx
Get the source code from the Nginx website.
Untar and change into the source directory
$ ./configure --with-prefix=/usr/local/nginx-0.6.32 $ make $ make install $ sudo ln -s /usr/local/nginx-0.6.32 /usr/local/nginx
Couchdb
Just relax and get Jan's excellent CouchDBX from here.
It is seriously not worth the pain trying to get Mozilla Spidermonkey to install on anything to get CouchDB running from source.
I am not starting any of the programs using LaunchD, since I don't have too much RAM to play with. If that is not a constraint for you, you can get instructions on setting up MySQL and Apache to kick off on start up from here.
Update: Drupal seems to have eaten up some four comments that were on this thread between edits. It is there in the database, but is not showing up here and I can't seem to figure out why that is the case. Apologies to those who had commented.






