openSUSE で tracインストール

openSUSE 10.3でtracのインストール&設定を行います。 既にインストールされているApache・Subversionと連携をしてみます。

tracのインストール要件

tracのイントールには以下の要件があり、結構めんどうですよね。

  • Python
  • ClearSliver
  • SQLite
  • PySQLite
  • Subversion
  • Apache + mod_python

参考:バグトラッキングシステム「Trac」インストール

なのでyastからパッケージをインストールします。
これだと、依存しているパッケージが勝手に入るので、簡単です。

インストール

でわ、インストール開始。 [yast] ⇒ [Software] ⇒ [Software Repositories]
より、[Add]を選択し、以下のリポジトリを追加。

http://download.opensuse.org/repositories/devel:/tools:/scm/openSUSE_10.3/

[yast] ⇒ [Software] ⇒ [Software Management] より、インストール。

trac 0.10.4

日本語版tracをインストールしなおすので、yastからtracをアンインストール。
(依存するパッケージが入っているのでよいんですよ。)
参考:trac-jaとは

アンインストールが終わったら、trac-jaをダウンロードしてインストール。

# wget http://www.i-act.co.jp/project/products/downloads/trac-0.10.4-ja-1.zip
# unzip trac-0.10.4-ja-1.zip
# cd trac-0.10.4-ja-1/
# python ./setup.py install --prefix=/srv/trac

本来yastでインストールされるはずの場所にシンボリックリンクを設定します。

参考:Trac-ja を新規でインストール

# ln -s /srv/trac/bin/trac-admin  /usr/bin/trac-admin
# ln -s /srv/trac/bin/tracd /usr/bin/tracd
# ln -s /srv/trac/bin/tracdb2env /usr/bin/tracdb2env
# ln -s /srv/trac/lib/python2.5/site-packages/trac /usr/lib/python2.5/site-packages/trac
# ln -s /srv/trac/share/man/man1/trac-admin.1 /usr/share/man/man1/trac-admin.1
# ln -s /srv/trac/share/man/man1/tracd.1 /usr/share/man/man1/tracd.1
# ln -s /srv/trac/share/man/man1/tracdb2env.1 /usr/share/man/man1/tracdb2env.1
# ln -s /srv/trac/share/trac /usr/share/trac

自力インストールの場合。(2008/3/20追記)
yastから、

  • python
  • pyton-devel
  • subversion-python
  • mod_python
  • python-sqlite

をインストールして以下のように、clearsilverをインストールする。

# wget http://www.clearsilver.net/downloads/clearsilver-0.10.5.tar.gz
# tar xvzf clearsilver-0.10.5.tar.gz
# cd clearsilver-0.10.5/
# ./configure --disable-perl --disable-csharp --with-python=/usr/bin/python
# make
# make install

Apacheの設定

openSUSEは、sysconfigエディターで設定しないと動作しないんです。ここ結構はまりますよね。

[yast] ⇒ [System] ⇒ [/etc/sysconfig Editor] より、Apache2 を開く。

Network
 - WWW
  - Apache2
  • APACHE_SERVER_FLAGSに以下を追加します。
TRAC_MODPYTHON
  • APACHE_MODULESに以下を追加します。
python

これで/etc/apache2/sysconfig.d/loadmodule.confに以下が追加されているはず。

LoadModule python_module                  /usr/lib/apache2/mod_python.so

/etc/apache2/conf.d/trac.confの設定をします。以下はyastでいれたときの設定ファイルを参考にしています。
mod_pythonで動作させるので、TRAC_CGIの個所は省略していいです。

<IfDefine TRAC_CGI>

        ScriptAlias /trac /usr/share/trac/cgi-bin/trac.cgi

        <Location "/trac">
                SetEnv TRAC_ENV_PARENT_DIR "/srv/trac"
                AllowOverride AuthConfig
                Order allow,deny
                Allow from all
        </Location>

</IfDefine>

<IfModule mod_python.c>
<IfDefine TRAC_MODPYTHON>

        ScriptAlias /trac "/srv/trac"   <-自力でインストールした場合は不要。

        <Location /trac>
                SetHandler mod_python
                PythonInterpreter main_interpreter
                PythonHandler trac.web.modpython_frontend
                PythonOption TracEnvParentDir /home/trac
                PythonOption TracUriRoot /trac
                Order allow,deny
                Allow from all
        </Location>

        <LocationMatch "/trac/[^/]+/login">
                AuthType Basic
                AuthName "Trac"
                AuthUserFile /etc/apache2/.tracpasswd
                Require valid-user
        </LocationMatch>

</IfDefine>
</IfModule>

プロジェクトの作成

まず、tracのプロジェクトを格納するディレクトリを作成します。

$ mkdir /home/trac

プロジェクト「private」(任意)を登録します。

$ trac-admin /home/trac/private initenv
Creating a new Trac environment at /home/trac/private

Trac will first ask a few questions about your environment
in order to initalize and prepare the project database.

 Please enter the name of your project.
 This name will be used in page titles and descriptions.

Project Name [My Project]> private

 Please specify the connection string for the database to use.
 By default, a local SQLite database is created in the environment
 directory. It is also possible to use an already existing
 PostgreSQL database (check the Trac documentation for the exact
 connection string syntax).

Database connection string [sqlite:db/trac.db]>

 Please specify the type of version control system,
 By default, it will be svn.

 If you don't want to use Trac with version control integration,
 choose the default here and don't specify a repository directory.
 in the next question.

Repository type [svn]>

 Please specify the absolute path to the version control
 repository, or leave it blank to use Trac without a repository.
 You can also set the repository location later.

Path to repository [/path/to/repos]> /srv/svn/repos

 Please enter location of Trac page templates.
 Default is the location of the site-wide templates installed with Trac.

Templates directory [/srv/trac/share/trac/templates]>

Creating and Initializing Project
 Installing default wiki pages
 /usr/share/trac/wiki-default/TracGuide => TracGuide
 /usr/share/trac/wiki-default/WikiHtml => WikiHtml
 …

Congratulations!

プロジェクトディレクトリ以下をApacheの実行ユーザーに変更します。

# chown -R wwwrun:www /home/trac/private

パスワードファイルの作成。 htpasswd2で作成。hogeとpowユーザーを作成してみる。

# htpasswd2 -b -c /etc/apache2/.tracpasswd hoge hogepass
# htpasswd2 -b /etc/apache2/.tracpasswd pow powpass

最後にApacheを再起動してtracを起動します!

# service apache2 restart

tracの設定

設定ファイルは、プロジェクトディレクトリ/conf/trac.iniにあります。
(/home/trac/work/conf/trac.ini) デフォルトだとリポジトリブラウザのファイル文字コードが合わないと文字化けしますので、以下のように変更しときます。

[trac]
#default_charset = iso-8859-15
default_charset = utf-8

TracWebAdminのインストール

TracWebAdminをインストールすればWeb画面でTracの設定が行えるようになります。
まず、yastから、python-setuptoolsをインストールします。

次に、cl.pocari.org|こちらを参考にして、日本語翻訳済みのTracWebAdminをセットアップします。

# cd /usr/local/src
# wget http://pocari.org/tools/trac/webadmin/webadmin-r4429-ja.patch
# svn export -r 4429 http://svn.edgewall.com/repos/trac/sandbox/webadmin/
# cd webadmin
# patch -p0 < ../webadmin-r4429-ja.patch 
# python ./setup.py bdist_egg 

これで、/usr/local/src/webadmin/dist/TracWebAdmin-0.1.2dev-py2.5.eggが作成されているので、
/home/trac/{プロジェクト}/pluginsへコピーすればインストールは完了です。
(20080423追記) もしくは/usr/lib/python2.5/site-packagesへコピーしとけば各プロジェクト共通で利用可能です。
trac.iniに以下を追記すれば設定完了になります。

[components]
webadmin.* = enabled 

管理ツールへのアクセスは、TRAC_ADMIN権限を持つユーザーでログインする必要があるので、以下のようにして権限を付与します。
以下は、sampleプロジェクトのhogeユーザーに権限を与えています。

# trac-admin /home/trac/sample
Trac [/home/trac/sample]> permission add hoge TRAC_ADMIN
Trac [/home/trac/sample]> exit

TimingAndEstimationプラグインのインストール

Timing And Estimationプラグインをセットアップします。
チケットに工数管理を追加するtracプラグインです。

# cd /usr/local/src
# unzip timingandestimationplugin_branches_trac0.10.zip
# cd timingandestimationplugin/branches/trac0.10
# python setup.py install

途中、以下のようなエラーがでたので、

    [Errno 2] No such file or directory: '/usr/local/lib/python2.5/site-packages/test-easy-install-8629.pth'

シンボリックリンクを貼ったらうまくいきました。

# ln -s /usr/lib/python2.5 /usr/local/lib/python2.5

TracWebAdminの管理メニュー、プラグインより有効化する。
trac001.jpg

最後にtrac-adminで環境を更新する。

# trac-admin /home/trac/private upgrade
Timing and Estimation needs an upgrade
Upgrading Database
Creating bill_date table
Creating report_version table
Upgrading report_version table to v4
Dropping report_version table
Upgrading reports
Upgrading fields
Upgrading usermanual
Done Upgrading
Upgrade done.

チケット登録画面のラベルを変更する場合、trac.iniの”~.label”を編集する。

[ticket-custom]
billable = checkbox
billable.label = Billable?
billable.order = 3
billable.value = 1
estimatedhours = text
estimatedhours.label = Estimated Number of Hours
estimatedhours.order = 1
estimatedhours.value = 0
hours = text
hours.label = Add Hours to Ticket
hours.order = 2
hours.value = 0
totalhours = text
totalhours.label = Total Hours
totalhours.order = 4
totalhours.value = 0

Scrum Burndownプラグインのインストール

Scrum Burndownプラグインをインストールします。

  • eggファイルの作成
svn co http://trac-hacks.org/svn/scrumburndownplugin/
cd scrumburndownplugin
python setup.py bdist_egg
  • eggファイルをコピーします
cp ./scrumburndownplugin/dist/TracBurndown-01.08.10-py2.5.egg \
/usr/lib/python2.5/site-packages/
  • trac.ini
[components]
burndown.* = enabled
  • upgrade
# trac-admin /home/trac/private upgrade

デフォルト設定を定義したい

homeserver/trac.txt · 最終更新: 2008/04/23 22:09 by whiteapple
www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0 openSUSE