2010年02月11日
Tracのインストールとプロジェクトの作成
yumでイントールすると依存ライブラリを気にせずに済むので簡単です。
1. yumにリポジトリを追加
/etc/yum.repos.d配下にdag.repoなど適当な名前でファイルを作成、以下を記述。[dag] name=Dag RPM Repository for Redhat EL4 baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag gpgcheck=1 enabled=1 gpgkey=http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
2. インストール
# yum install trac
完了です。
せっかくなので、tracのプロジェクトも作成してみます。
1. tracプロジェクトの作成
hogeというプロジェクトを作成するとします。# trac-admin /path/to/trac/hoge initenv
以下、指示にしたがって進めます。
# プロジェクト名を入力 Project Name [My Project]> # 未入力でエンター Database connection string [sqlite:db/trac.db]> # 未入力でエンター Repository type [svn]> # svnリポジトリの場所を入力 Path to repository [/path/to/repos]> # 未入力でエンター Templates directory [/usr/share/trac/templates]>
2. 作成されたプロジェクトをapacheの所有に変更
# chown -R apache:apache /path/to/trac/hoge
3. 認証用のファイルを作成
# trac-admin /path/to/trac/hoge permission add user1 TRAC_ADMIN※権限にはいくつか種類がありますので、詳しくはこちらを。
・Trac Permissions
続いて、認証用ファイルを作成、ユーザー「user1」を追加。
htpasswd -c /path/to/trac/.htpasswd user1※同じ認証用ファイルにユーザを追加する場合、-cオプションは不要です。
4. apacheの設定
tracインストールの際、/etc/httpd/conf.d配下に「trac.conf」が作成されているので修正します。
以下は、VirtualHost使用時の例です。
<VirtualHost *:80>
DocumentRoot /path/to/trac
ServerName www.example.orz
<Location /trac>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /path/to/trac
PythonOption TracUriRoot /trac
</Location>
<LocationMatch "/trac/[^/]+/login">
AuthType Basic
AuthName "Trac"
AuthUserFile /path/to/trac/.htpasswd
Require valid-user
</LocationMatch>
</VirtualHost>
apacheを再起動します。
これで以下のURLでそれぞれアクセスできます。
・http://www.example.orz/trac <- プロジェクト一覧
・http://www.example.orz/trac/hoge <- hogeプロジェクト
実行環境
CentOS 5.3
Trac 0.11.5
CentOS 5.3
Trac 0.11.5
