Categories

  • AIX

IMPORTANT: This tutorial is not complete. if you scroll to the bottom you will see that there is a bug with mod_wsgi that I have not been able to fix as of yet.

For the setup of Apache2 I have used the RPMs contributed by Michael Perzl http://www.perzl.org/aix/index.php?n=Main.Apache

For most of my packages I tend to use the AIX Toolbox for Linux Applications but it seems that they only provide RPMs for Apache 1.3 since they now have an IBM http server which is based off of Apache 2.0. I haven’t used this and I don’t really want to pay for it. (At the time of writing this the IBM http server website only offers trial versions)

First things first, lets install wget onto the system so that we can get the rest of our files much easier. The versions i used here may have changed so please visit http://www.perzl.org/aix/index.php?n=Main.Wget and check out the current version, along with it’s dependencies.

#install WGET 
rpm -hUv bash-4.2-5.aix5.1.ppc.rpm info-4.13a-2.aix5.1.ppc.rpm libidn-1.22-1.aix5.1.ppc.rpm expat-2.0.1-3.aix5.1.ppc.rpm gettext-0.17-1.aix5.1.ppc.rpm --nodeps glib2-2.28.6-1.aix5.1.ppc.rpm openssl-1.0.0e-1.aix5.1.ppc.rpm wget-1.13.4-2.aix5.1.ppc.rpm

Node Take note that I installed gettext-0.17-1.aix5.1.ppc.rpm with the –nodeps flag this is to get around a dependence on libxlsmp.a(smprt.o)

Now that we have wget we can download the following files directly to the server. You can use the following command but I would HIGHLY recommend going to the site and getting the most recent versions. <pre&

wget
#install apache 2.2.21
rpm -hUv apr-1.4.5-1.aix5.2.ppc.rpm apr-util-1.3.12-1.aix5.1.ppc.rpm db4-4.7.25-2.aix5.1.ppc.rpm apr-util-db4-1.3.12-1.aix5.1.ppc.rpm gdbm-1.9.1-1.aix5.1.ppc.rpm apr-util-gdbm-1.3.12-1.aix5.1.ppc.rpm openldap-2.4.23-0.2.aix5.1.ppc.rpm apr-util-ldap-1.3.12-1.aix5.1.ppc.rpm readline-6.2-2.aix5.1.ppc.rpm unixODBC-2.3.0-1.aix5.1.ppc.rpm apr-util-odbc-1.3.12-1.aix5.1.ppc.rpm bzip2-1.0.6-1.aix5.1.ppc.rpm zlib-1.2.5-1.aix5.1.ppc.rpm pcre-8.13-1.aix5.1.ppc.rpm httpd-2.2.21-1.aix5.1.ppc.rpm

Installing the http development files which may be needed of you are compiling modules such as mod_wsgi. Sadly this has a lot pr deps associated with it as you can see from looking at the website. Most notably it require freetds which is dependent on gnutls which has a large number of deps. so here we go.

#lets install gnutls and its required filesets
mkdir gnutls
cd gnutls

wget http://www.oss4aix.org/download/RPMS/libgpg-error/libgpg-error-1.10-1.aix5.1.ppc.rpm http://www.oss4aix.org/download/RPMS/libgcrypt/libgcrypt-1.5.0-1.aix5.1.ppc.rpm http://www.oss4aix.org/download/RPMS/libtasn1/libtasn1-2.9-1.aix5.1.ppc.rpm http://www.oss4aix.org/download/RPMS/lzo/lzo-2.06-1.aix5.1.ppc.rpm http://www.oss4aix.org/download/RPMS/gmp/gmp-5.0.2-1.aix5.1.ppc.rpm http://www.oss4aix.org/download/RPMS/nettle/nettle-2.4-1.aix5.1.ppc.rpm httpd-2.2.21-1.aix5.1.ppc.rpm http://www.oss4aix.org/download/RPMS/p11-kit/p11-kit-0.6-1.aix5.1.ppc.rpm http://www.oss4aix.org/download/RPMS/gnutls/gnutls-2.12.11-1.aix5.1.ppc.rpm

rpm -hUv *.rpm

cd ..
mkdir apache-devel
cd apache-devel

#wget the files

#installing http-devel
rpm -hUv pkg-config-0.25-2.aix5.1.ppc.rpm apr-devel-1.4.5-1.aix5.2.ppc.rpm db4-devel-4.7.25-2.aix5.1.ppc.rpm expat-devel-2.0.1-3.aix5.1.ppc.rpm freetds-0.82-2.aix5.1.ppc.rpm freetds-devel-0.82-2.aix5.1.ppc.rpm openldap-devel-2.4.23-0.2.aix5.1.ppc.rpm sqlite-3.7.8-1.aix5.1.ppc.rpm sqlite-devel-3.7.8-1.aix5.1.ppc.rpm unixODBC-devel-2.3.0-1.aix5.1.ppc.rpm apr-util-devel-1.3.12-1.aix5.1.ppc.rpm httpd-devel-2.2.21-1.aix5.1.ppc.rpm

Installing the manuals for apache never hurts

#install the manual
rpm -hUv httpd-manual-2.2.21-1.aix5.1.ppc.rpm

And finally we will install mod-ssl onto the system.

#install mod-ssl
rpm -hUv mod_ssl-2.2.21-1.aix5.1.ppc.rpm

The files related to Apache should now be located under the following directories(just to list a few):

find / -name 'httpd*'
...
/etc/rc.d/init.d/httpd
/opt/freeware/sbin/apachectl
/opt/freeware/sbin/httpd
/opt/freeware/etc/httpd/conf/
/opt/freeware/doc/httpd-2.2.21
...

Now not to say that you are the type of person to make terrible mistakes such as myself. But now would be a good time to make a mksysb of the system in this state before proceeding to installing the python, mod_python and django.

Ok, so now for python I have decided to use version 2.6.2 from the IBM AIX Toolbox for Linux Applications. Available through:

Website http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/alpha.html FTP Server ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox

I will be getting my files from the FTP server, and as always just use this as an example get the urls for the latest versions:

wget ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/python/python-2.6.2-1.aix5.3.ppc.rpm  ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/python/python-devel-2.6.2-1.aix5.3.ppc.rpm ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/python/python-docs-2.6.2-1.aix5.3.ppc.rpm ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/python/python-tools-2.6.2-1.aix5.3.ppc.rpm ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/python/tkinter-2.6.2-1.aix5.3.ppc.rpm ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/gdbm/gdbm-1.8.3-5.aix5.2.ppc.rpm ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/gdbm/gdbm-devel-1.8.3-5.aix5.2.ppc.rpm ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/tcltk/tcl-8.4.7-4.aix6.1.ppc.rpm ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/tcltk/tk-8.4.7-4.aix6.1.ppc.rpm

#install tcl/tk
rpm -hUv tcl-8.4.7-4.aix6.1.ppc.rpm  tk-8.4.7-4.aix6.1.ppc.rpm

#install python and deps
rpm -hUv gdbm-devel-1.8.3-5.aix5.2.ppc.rpm python-2.6.2-1.aix5.3.ppc.rpm python-devel-2.6.2-1.aix5.3.ppc.rpm python-docs-2.6.2-1.aix5.3.ppc.rpm

Ok so now comes the point where I ran into a dependancy problem on python-tools-2.6.2-1.aix5.3.ppc.rpm stating that:

# rpm -hUv python-tools-2.6.2-1.aix5.3.ppc.rpm
error: failed dependencies:
        /usr/local/bin/python is needed by python-tools-2.6.2-1

To get around this problem I did the following, feel free to leave a better solution in the comments if you have one.

mkdir -p /usr/local/bin
ln -s `which python` /usr/local/bin/python
rpm -hUv python-tools-2.6.2-1.aix5.3.ppc.rpm --nodeps

So yay all is well we now have Python 2.6.2 (r262:71600, Aug 26 2010, 14:46:22), lets see if we can get Django up and running. To do this head on over to https://www.djangoproject.com/download/ and get your version of Django. In my case this will be Django-1.2.7.tar.gz

When you have the file send it to the server and extract, build, install.

gzip -d Django-1.2.7.tar.gz
tar xf Django-1.2.7.tar
cd Django-1.2.7
python setup.py build
python setup.py install

That should be enough to get everything installed and running on the system and you can verify this by running python and checking your Django VERSION variable.

# python
Python 2.6.2 (r262:71600, Aug 26 2010, 14:46:22) [C] on aix5
 import django
 print django.VERSION
(1, 2, 7, 'final', 0)

Now that we have Apache2, Apache2-devel, Python, and Django we will need to setup mod_wsgi to tie it all together. Although they are not mentioned in the docs there are a few more pre-reqs that must be met before this will work on our AIX box. Most notably we need to install tools such as GCC for compiling, and this can be very troublesome since it is tightly bound to the version of AIX you are using since gcc relies on the IBM XL compilers to generate object code.

Now at this point I should mention that it seems that in order for this you will need to have IBM XL C compiler installed and this certainly doesn’t seem to be a free product. So you will need to get the filesets for this and install it using smit or installp. For me I have access to the Academic Initiative so I downloaded all the XL C/C++ files I needed. And then proceeded through the labyrinth that is IBM FixCentral.

Fun fact if you have Rational, XL C,C++ Compiler version 11.1.0.0, for AIX which is the base install. It is NOT compatible with AIX 7.1 you will need to download a PTF for it. Go to http://www.ibm.com/support/fixcentral/ and search under:

Product Group Rational

Product: XL C,C++ Compiler

Installed version 11.1.0.0 (in my case)

Platform AIX

Once you get past this you can search for APAR IZ84777 and download the PTF to fix this madness up.

So after that digression we will continue. If you are reading past here I’ll assume you have XL C installed and patched up.

Lets install SED, and some compiler tools.

wget http://www.oss4aix.org/download/RPMS/sed/sed-4.2.1-2.aix5.1.ppc.rpm
rpm -hUv sed-4.2.1-2.aix5.1.ppc.rpm

#get the filesets needed for compilation
wget http://www.oss4aix.org/download/RPMS/gcc/gcc-4.6.1-1.aix7.1.ppc.rpm http://www.oss4aix.org/download/RPMS/gcc/gcc-c++-4.6.1-1.aix7.1.ppc.rpm http://www.oss4aix.org/download/RPMS/gcc/gcc-cpp-4.6.1-1.aix7.1.ppc.rpm http://www.oss4aix.org/download/RPMS/mpfr/mpfr-3.0.1-1.aix5.1.ppc.rpm http://www.oss4aix.org/download/RPMS/gcc/libgcc-4.6.1-1.aix7.1.ppc.rpm http://www.oss4aix.org/download/RPMS/gcc/libgomp-4.6.1-1.aix7.1.ppc.rpm http://www.oss4aix.org/download/RPMS/gcc/libstdc++-4.6.1-1.aix7.1.ppc.rpm http://www.oss4aix.org/download/RPMS/gcc/libstdc++-devel-4.6.1-1.aix7.1.ppc.rpm
http://www.oss4aix.org/download/RPMS/libmpc/libmpc-0.9-1.aix5.1.ppc.rpm

#install filesets for compiling
rpm -hUv *.rpm  

gzip -d mod_wsgi-3.3.tar.gz
tar xf mod_wsgi-3.3.tar
cd mod_wsgi-3.3

#ensure your XL c/C++ compiler is in your path /usr/vac/bin ... if not
export PATH=$PATH:/usr/vac/bin

./configure --with-apxs=/opt/freeware/sbin/apxs

make
make install

At this point you have to edit /opt/freeware/etc/httpd/conf/httpd.conf and add LoadModule wsgi_module /opt/freeware/lib/httpd/modules/mod_wsgi.so

After running /etc/rc.d/init.d/httpd restart I found two errors stating that the symbols ap_cleanup_scoreboard and ap_accept_lock_mech could not be loaded. There is a proposed solution to this at. http://code.google.com/p/modwsgi/issues/detail?id=212. This requires that a header file be changed in the Apache 2 source code and that it then be compiled with these changes. I have had no luck doing this…. I will let you know when I find a solution.

Please leave a comment if you have found a way around it.

As an alternative, until i get mod_wsgi running there is a version of mod_python available from Michael Perzl site, if you have followed my previous steps then you can install it with.

wget http://www.oss4aix.org/download/RPMS/python/python-libs-2.6.2-1.aix5.1.ppc.rpm

#you will have conflicts with the previous version of python i forced it in and everything worked out fine.
#the previous version of python was from the AIX toolbox and they don't have the libs available.
rpm --force -i python-libs-2.6.2-1.aix5.1.ppc.rpm

wget http://www.oss4aix.org/download/RPMS/mod_python/mod_python-3.3.1-1.aix5.1.ppc.rpm
rpm -hUv mod_python-3.3.1-1.aix5.1.ppc.rpm

/etc/rc.d/init.d/httpd restart