【Debian】Apacheにmod_pythonを組み込む
ApacheでDjangoアプリを動かすには、mod_pythonとやらがいるらしい。
mod_perlの様な感じで、起動時にメモリにプログラムを読み込んで動作するらしい。
(参考:http://djangoproject.jp/doc/ja/1.0/howto/deployment/modpython.html)
Debian環境なので、apt-getしてみる。
apt-get install mod_python
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
E: パッケージ mod_python が見つかりません
無いって。。。
じゃあwgetでとってくる。
wget http://archive.apache.org/dist/httpd/modpython/mod_python-3.3.1.tgz
archive.apache.org をDNSに問いあわせています... 140.211.11.131
archive.apache.org|140.211.11.131|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 447954 (437K) [application/x-tar]
`mod_python-3.3.1.tgz' に保存中
100%[================================================>] 447,954 309K/s 時間 1.4s
2012-08-18 20:19:32 (309 KB/s) - `mod_python-3.3.1.tgz' へ保存完了 [447954/447954]
やったmod_pythonゲットした。
解凍。
tar xfz mod_python-3.3.1.tgz
さて、これをどうするか調べるか。
cd mod_python-3.3.1
./configure --with-python=/usr/bin/python2.6
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for ar... ar
checking for a BSD-compatible install... /usr/bin/install -c
checking whether make sets $(MAKE)... yes
checking for main in -lm... yes
checking for an ANSI C-conforming const... yes
checking your blood pressure... a bit high, but we can proceed
configure: checking whether apxs is available...
checking for --with-apxs... no
checking for apxs in /usr/local/apache/sbin... no
checking for apxs in your PATH... checking for apxs... no
checking for apxs2 in your PATH... checking for apxs2... no
configure: WARNING: **** apxs was not found, DSO compilation will not be available.
configure: WARNING: **** You can use --with-apxs to specify where your apxs is.
configure: error: Neither static nor DSO option available, there is no point in continuing.
apxsが無いって。
http://kitajima-antenna.seesaa.net/article/121370094.htmlを参考に。
apache2-prefork-devに含まれるらしい。
sudo apt-get upgrade
sudo apt-get install apache2-prefork-dev
入った。
再び。。。。
cd mod_python-3.3.1
./configure --with-python=/usr/bin/python2.6
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
~
~
~
configure: WARNING: flex not found
You can generally ignore this warning unless you need to regenerate
psp_parser.c from psp_parse.l. If you do need regenerate psp_parser.c,
use --with-flex to specify the location of flex.
See the README for more information.
~
~
~
今度はflexが無いと。。。
apt-get install flex
でflex追加して。
再チャレンジ。
cd mod_python-3.3.1
./configure --with-python=/usr/bin/python2.6
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
~
~
~
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating Doc/Makefile
config.status: creating src/include/mod_python.h
config.status: creating test/Makefile
config.status: creating test/testconf.py
config.status: creating dist/setup.py
config.status: creating dist/Makefile
いったっぽいのかな?
では、、、、、
make
~
~
make[1]: *** [mod_python.so] エラー 1
make[1]: ディレクトリ `/root/hoge/mod_python-3.3.1/src' から出ます
make: *** [do_dso] エラー 2
くそう。。。
では、http://www.abetake.com/index.php?mod_python%203.3.1とhttp://d.hatena.ne.jp/paraches/20080123を参考に。。。
vi /root/hoge/mod_python-3.3.1/src/connobject.c
./configure --with-apxs=/usr/bin/apxs2
make
いった!!!
make install
よし。
とりあえずapacheの設定はまた後日!