Friday, June 19, 2009

Howto install python and mod_python on linux

Installing Python

If you want to install it onto custom directory, for example like /home/you/opt/Python

Get python sources from

Untar it.

./configure --prefix=/home/you/opt/Python --exec-prefix=/home/you/opt/Python --enable-shared

make; make install;

Installing mod_python

Get mod_python from here

Untar it.

./configure --prefix=/home/you/opt/mod_python --exec-prefix=/home/you/opt/mod_python --with-apxs=/home/you/opt/httpd/bin/apxs --with-python=/home/you/opt/Python/bin/python

# because normal 'make install' needs 'su' access,
make; make install_dso; make install_py_lib

add below configurations into httpd.conf

LoadModule python_module modules/

<Directory [absolute path]>
AddHandler mod_python .py
PythonHandler test
PythonDebug On
Restart httpd. It'll works.

No comments:

Post a Comment