Install Python2.5 and mod_python to CentOS(64bit)
このエントリは2007/12/05の再掲です
64ビット版CentOSに、Pythonとmod_pythonをインストールする件についてです。Linuxのコンポーネント管理ツールyum がシステムのPythonバージョンに依存するので、システムPythonをアップグレードすることができません。なので、独自のPythonをインストールします。
英語サイトを探しても、フォーラムで部分的に議論されているものが大量に出てくるものの、明確な方法があまり書かれていなかったので、手順を英語で書いておきます。
CentOS system global Python version is 2.3. This is not able to upgrade!! OS component manager of "yum" depends on Python2.3. If Python might be upgraded, yum will dead and all components (contains Python) will never be managed. We need alternative install to another directory for modern Python and its modules.
Python2.5.1
To avoid static link by python modules(e.g. mod_python) you should run configure script with "--enable-shared" option.
If ".so" might not be found on running Python, add the shared library dir to "ld.so.conf" settings and run ldconfig.
$ ./configure --enable-shared
(install dir is not considerd because the configure's default prefix is /usr/local.)
To enable SSL, installing openssl-devel required. It's convenient to test your secure application with urllib or urllib2 module by itself.
$ yum install openssl-devel
Edit openssl installed prefix(/usr) and libraly directory(lib64) in Modules/Setup in Python source code.
SSL=/usr _ssl _ssl.c \ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ -L$(SSL)/lib64 -lssl -lcrypto
Build and install.
$ make
$ make install
Enable to find your dyamic link liblary.
$ echo /usr/local/lib > /etc/ld.so.conf.d/python2.5.conf $ ldconfig
apxs
"apxs" is extension development framework for Apache web server. mod_python requires apxs.
$ yum install httpd-devel
mod_python
IMPORTANT: Don't forget to specify your own compiled Python with --with-python.
$ ./configure --with-python=/usr/local/bin/python2.5 $ make $ make install
Add mod_python to Apache config and restart web server.
$ echo LoadModule python_module /usr/lib64/httpd/modules/mod_python.so\ > /etc/httpd/conf.d/python.conf $ service httpd restart