ITeye博客

Linux下Apache+Python环境搭建

zrcoffee · 2011-05-27 15:05 · Linux · 操作系统 · Apache · GCC · CentOS · Python · Linux · Markdown

一.环境说明 1.系统环境 CentOS release 5.4 (Final)

2.软件版本 Apache 2.2.3 Python 2.6.6 mod_python 3.3.1

二.安装Apache 1.如果使用Apache源码进行安装,请到http://httpd.apache.org下载所需版本。 安装过程略。

2.如果使用系统自带的Apache,则需要查看系统是否安装httpd-devel包。操作如下: [root@G7-75 ~]# yum list httpd-devel 如果已安装,则跳过以下步骤: [root@G7-75 ~]# yum search httpd-devel [root@G7-75 ~]# yum install httpd-devel.x86_64

三.安装Python [root@G7-75 ~]# tar -jxvf Python-2.6.6.tar.bz2 [root@G7-75 ~]# cd Python-2.6.6 [root@G7-75 Python-2.6.6]# CCSHARED="-fPIC" ./configure [root@G7-75 Python-2.6.6]# vi Makefile 如果CC= gcc -pthread,则修改为CC= gcc -pthread -fPIC [root@G7-75 Python-2.6.6]# make [root@G7-75 Python-2.6.6]# make install 注意:Python的安装目录是/usr/local/lib/python2.6/

四.安装mod_python [root@G7-75 ~]# tar -xvf mod_python-3.3.1.tar [root@G7-75 ~]# cd mod_python-3.3.1 [root@G7-75 mod_python-3.3.1]# whereis apxs apxs: /usr/sbin/apxs /usr/share/man/man8/apxs.8.gz [root@G7-75 mod_python-3.3.1]# ./configure --with-apxs=/usr/sbin/apxs --with-python=/usr/local/bin/python [root@G7-75 mod_python-3.3.1]# make [root@G7-75 mod_python-3.3.1]# make install(/usr/local/lib/python2.6/site-packages/mod_python) 注意:如果没有源码包请到http://www.modpython.org/下载

五.配置Apache [root@G7-75 mod_python-3.3.1]# cd src [root@G7-75 src]# cp mod_python.so /etc/httpd/modules/ [root@G7-75 src]# cd /etc/httpd/conf [root@G7-75 conf]# vi httpd.conf 添加LoadModule python_module modules/mod_python.so

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。