tracをWindowsにインストールするメモ。

なんだかハマれそうでメンドクサそうなWindowsへのインストールをしてみたメモです。書き方が雑なのは元がRandamNoteに書いていったメモだからです。

Last-Modified:

プロジェクトサイト

http://projects.edgewall.com/trac/

BTS+Wiki+Subversionリポジトリブラウザみたいな感じのツール。

必要なもの。

http://projects.edgewall.com/trac/wiki/TracInstall

Python(Python 2.3.4)
http://www.python.org/download/ -> http://www.python.org/ftp/python/2.3.4/Python-2.3.4.exe
Subversion
-
Subversion Python bindings(svn-win32-1.1.1_py.zip)
http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91
SQLite(sqlitedll-3_0_8.zip)
http://www.sqlite.org/download.html
PySQLite(pysqlite-1.1.3.win32-py2.3.exe)
http://pysqlite.sourceforge.net/
ClearSilver(clearsilver_python-0.9.12-win32.zip)
http://www.clearsilver.net/downloads/
Docutils(docutils-0.3.5.tar.gz)
http://docutils.sourceforge.net/#download

いんすとろーる。

Subversion

なんか1.0.1だと不幸なので1.1.1をいれましょう。

Python

D:\Program Files\Python23 にインストール。Tcl/Tkと拡張子登録、スタートに追加はチェックはずす。

PySQLite

とりあえず普通にインストーラでインストール。

Subversion Python bindings

svn-win32-1.1.1_py.zip をばらして python の中の svn と libsvn フォルダを D:\Program Files\Python23\Lib\site-packages につっこむ。

Clearsilver

clearsilver_python-0.9.12-win32.zip をばらして、ファイル neo_cgi.pyd を D:\Program Files\Python23\Lib\site-packages\ に。

Docutils

アーカイブを展開したら

D:\temp\trac\docutils-0.3.5>"\Program Files\Python23\python.exe" setup.py install

とかやる。

本体

アーカイブを展開したら

D:\temp\trac\trac-0.8>"\Program Files\Python23\python.exe" setup.py install

とかやる。

CGIをおくために D:\pub\wwwroot\_tmp\trac とかを作る。で、そこに trac-0.8\htdocs のものを移して trac-0.8\cgi-bin もフォルダごとコピーする。

D:\pub\wwwroot\_tmp\trac\cgi-bin\trac.cgi の先頭を #!/usr/bin/python から #!"D:/Program Files/Python23/python.exe" とかにする。

D:\pub\wwwroot\_tmp\trac\.htaccess に

SetEnv TRAC_ENV "E:/Repository/trac/testproject"

とかてけとーにプロジェクトディレクトリの位置(ここではtestproject)を書く。

で、プロジェクトディレクトリを初期化するので trac のディレクトリを作って(testprojectは作らない)

D:\Program Files\Python23>mkdir E:\Repository\trac
D:\Program Files\Python23>python.exe Scripts\trac-admin E:/Repository/trac/testproject initenv

とかやる。

設定

trac-adminを実行するとなんか入力を迫られるのでぺちぺち入力する。とりあえず以下のようにしてみた。

Project Name [My Project]> Test Project
Path to repository [/var/svn/test]> E:/Repository/svnroot/atlimit
Templates directory [D:\Program Files\Python23\share\trac\templates]>

とりあえず手元に差分れぽ(謎)は atlimit しかないのでそれにする。

Congratulations!

とか言われてできあがり。

というところで http://localhost/_tmp/trac/cgi-bin/trac.cgi とかにアクセスすると何か見えます。 まあ動いてるだけです。認証が未設定なことや画像,CSSファイルの位置が変なことその他いろいろ不便なのでバーチャルホストとか切るとか細かい設定をしましょう。

そういえば、SQLite DLLいらなかったです。PySQLiteに含まれてたみたいです。

動いてない!

なんか動かなかったりエラーが出る場合はDLLが足りなそうな予感です。適当に見繕って %SYSTEMROOT%\System32\ にでもつっこみましょう。

あと、ちなみに私の手元のPATH変数にはSubversionのパスが書いてあります。ないとダメかも。

さらに設定

とりあえず projectname.trac.misuzilla.local という風に設定してみるてすと。

DocumentRootになるD:\pub\wwwroot\trac.misuzilla.localというディレクトリを作ってさっきのhtdocstracディレクトリに、cgi-binフォルダの中身をDocumentRootにコピーする。

httpd.conf (VirtualHost)

#
# trac.misuzilla.local
#
<VirtualHost *:*>
	ServerAdmin webmaster@trac.misuzilla.local
	ServerName trac.misuzilla.local:80
	ServerAlias *.trac.misuzilla.local
	DocumentRoot "D:/pub/wwwroot/trac.misuzilla.local"
	SetOutputFilter DEFLATE
	
	SetEnvIf Host ^(.+)\.trac\.misuzilla\.local$ TRAC_ENV=E:/Repository/trac/$1
    #ErrorLog d:/windows/logfiles/httpd/trac.misuzilla.local_error_log.txt
	
	<Directory "D:/pub/wwwroot/trac.misuzilla.local">
		DirectoryIndex trac.cgi index.html index
		Options +Indexes +MultiViews +FollowSymLinks +SymLinksIfOwnerMatch +ExecCGI
		AllowOverride None
		Order allow,deny
		Allow from all
	</Directory>
	
	<Location "/trac.cgi/login">
		AuthType Basic
		AuthName "trac"
		AuthUserFile D:/pub/wwwroot/trac.misuzilla.local/.htpasswd
		Require valid-user
	</Location>

</VirtualHost>

あとは http://testproject.trac.misuzilla.local/ とかでアクセス(もちろん名前解決できないとダメですが)。

参考リンク

かえるの寝言さんのところにいろいろ書かれていてとても役立ちます。