研究室で共有ソフトウェア開発プロジェクトが一気に2つくらい走り出しそうなので、インフラの整備と言うことでSubversionに続いてtracをインストールすることにした。*1最初portinstallやpkg_addしても全然接続できなくて、おそらくfirewallのせいだろうとは思ったんだけど、肝心のportsに使うポート番号が分からない。*2仕方がないのでとりあえずfirewall切って設定開始。設定が終わったらまたfirewall立てよう。
まず下準備としてportsnap fetchとupdateをしてから下記のパッケージをインストール。
#portinstall python #portinstall sqlite3 #portinstall databases/py-sqlite3 #portinstall databases/postgresql81-server <- ついでに入れたくなった #portinstall devel/subversion-python #portinstall www/clearsilver #portinstall www/clearsilver-python #portinstall japanese/trac
これでとりあえず大丈夫っぽい。試しにやってみた。
#mkdir /home/trac/foo #trac-admin /home/trac/foo initenv Project Name [My Project]> foo_project Database connection string [sqlite:db/trac.db]> Repository type [svn]> Path to repository [/path/to/repos]> /home/svn/foo <- 以前svnで作ったレポジトリ Templates directory [/usr/share/trac/templates]> : Congratulations! #chmod -R www:www /home/trac
でもって/usr/local/etc/apache2のhttpd.confを書き換える。
<VirtualHost *> ServerName www.foo_project.net <Location /> SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonOption TracUriRoot "/" PythonOption TracEnvParentDir /home/trac </Location> </VirtualHost>
これで再起動したらエラーがでた。
#/usr/local/sbin/httpd -k restart Syntax error on line 1095 of /usr/local/etc/apache2/httpd.conf: Invalid command 'PythonHandler', perhaps mis-spelled or defined by a module not included in the server configuration
どう考えてもおかしい。で、見てみるとLoadModuleのところにmod_pythonないし。さらに/usr/local/libexecにmod_pythonないし。というわけでmod_pythonを入れましょう。
#portinstall www/mod_python3 #emacs /usr/local/etc/apache2/httpd.conf LoadModule mod_python /libexec/apache2/mod_python.so
これで大丈夫なはずなので再起動。
#/usr/local/sbin/httpd -k restart Segmentation fault: 11 (core dumped)
はぁ?落ちたよ。で、いろいろ調べてみるとどうやらこれは結構頻繁に起きてることらしい。
- mod_python Segmentation fault importing django.utils.feedgenerator.py - with fix - Django users | Google Groups
- ModPython/Articles/ExpatCausingApacheCrash - Graham's Project Wiki
とりあえずExpatのバージョンを調べることにした。
# ldd /usr/local/sbin/httpd | grep expat libexpat.so.6 => /usr/local/lib/libexpat.so.6 (0x28200000) # strings /usr/local/lib/libexpat.so.6 | grep expat_ expat_2.0.0
これで今動いているExpatのバージョンは2.0.0と分かった。ここでlsofというコマンドが必要なためこれを入れる。Apacheで使ってるExpatを調べる。
#portinstall sysutils/lsof #ps aux | grep http | head -3 root 678 0.0 2.2 16848 11148 ?? Ss 5:15PM 6:25.83 /usr/local/sbin/httpd www 19412 0.0 2.2 16848 11164 ?? I 11:26PM 0:00.01 /usr/local/sbin/httpd www 19413 0.0 2.2 16848 11164 ?? I 11:26PM 0:00.01 /usr/local/sbin/httpd #/usr/local/sbin/lsof -p 678 | grep expat httpd 678 root txt VREG 0,88 157428 1155446 /usr/local/lib/libexpat.so.6 #strings /usr/local/lib/libexpat.so.6 | grep expat_ expat_2.0.0
今度はpythonが使ってるExpatのバージョンを調べる。
#python Python 2.4.4 (#2, Apr 10 2007, 17:26:18) [GCC 3.4.6 [FreeBSD] 20060305] on freebsd6 Type "help", "copyright", "credits" or "license" for more information. >>> import pyexpat >>> pyexpat.version_info (1, 95, 8)
うっわ。違ってるし。どうしようかな。また今度考えよう。つづく。。。