trac 的安裝及使用筆記

8月 10th, 2006 Comments Off

trac – http://trac.edgewall.org/
Trac is an enhanced wiki and issue tracking system for software development projects. Trac uses a minimalistic approach to web-based software project management. Our mission; to help developers write great software while staying out of the way. Trac should impose as little as possible on a team’s established development process and policies.

用來管理專案是很方便的工具

for Ubuntu:

* 安裝:

sudo apt-get install trac libapache2-svn libapache2-mod-python

* 設定 Subversion:

mkdir -p /srv/svn/gcin
svnadmin create /srv/svn/gcin
chown -R www-data.www-data /srv/svn/gcin

編輯 /etc/apache2/mods-available/dav_svn.conf:

<Location /svn>
   DAV svn
   SVNPath /srv/svn/gcin
   SVNAutoVersioning On
   AuthType Basic
   AuthName "Subversion Repository"
   AuthUserFile /etc/apache2/svn.passwd
   AuthzSVNAccessFile /etc/apache2/svn.authz
  #<LimitExcept GET PROPFIND OPTIONS REPORT>
   Require valid-user
  #</LimitExcept>
</Location>

設定帳號及權限:

/etc/apache2/svn.passwd:

htpasswd2 -c -m /etc/apache2/svn.passwd candyz
chown www-data /etc/apache2/svn.passwd
chmod 600 /etc/apache2/svn.passwd

/etc/apache2/svn.authz:

[/]
candyz = rw
* = r

[/trunk]
candyz = rw
* =
chown www-data /etc/apache2/svn.authz
chmod 600 /etc/apache2/svn.authz

svn import:

tar jxvf gcin-1.2.1.tar.bz2
mv gcin-1.2.1 gcin
svn import gcin http://ibook/svn/gcin/trunk -m "initial import for gcin-1.2.1" --username candyz
svn mkdir http://ibook/svn/gcin/tags -m "mkdir tags" --username candyz
svn mkdir http://ibook/svn/gcin/branches -m "mkdir branches" --username candyz
svn copy http://ibook/svn/gcin/trunk http://ibook/svn/gcin/tags/release-1.2.1 -m "Tagging the 1.2.1 release of gcin project." --username candyz
svn checkout http://ibook/svn/gcin/trunk gcin --username candyz
tar jxvf gcin-test.tbz
cp -a gcin-1.2.2/* gcin/
cd gcin
svn status
svn add config.h eggtrayicon.c tray.c eggtrayicon.h gcin-tray.png trad2sim gcin-tray-sim.png
svn commit -m "update to 1.2.2 preview version"
svn status
svn up

* 建立 Trac Environment:

mkdir -p /srv/trac
trac-admin /srv/trac/gcin initenv
chown -R www-data.www-data /srv/trac/gcin

* apache2 的設定:
編輯 /etc/apache2/sites-available/default 加在 </VirtualHost> 之前即可:

<Location /trac>
   SetHandler mod_python
   PythonHandler trac.web.modpython_frontend
   PythonOption TracEnv /srv/trac/gcin
   PythonOption TracUriRoot /trac
</Location>
<Location /trac/login>
   AuthType Basic
   AuthName "trac"
   AuthUserFile /etc/apache2/svn.passwd
   Require valid-user
</Location>

restart apache2:

sudo /etc/init.d/apache2 restart

for Fedora/RHEL4

* 安裝:
相關套件可以到 DAG 的 Repository 去下載 – http://dag.wieers.com/home-made/apt/
以 RHEL4 為例,需要底下三個套件:
clearsilver-0.10.1-1.2.el4.rf.i386.rpm
python-clearsilver-0.10.1-1.2.el4.rf.i386.rpm
trac-0.9.6-1.el4.rf.noarch.rpm

* 設定 Subversion:

mkdir -p /srv/svn/gcin
svnadmin create /srv/svn/gcin
chown -R apache.apache /srv/svn/gcin

編輯 /etc/httpd/conf.d/subversion.conf:

<Location /svn>
   DAV svn
   SVNPath /srv/svn/gcin
   SVNAutoVersioning On
   AuthzSVNAccessFile /etc/httpd/private/svn.access
   AuthType Basic
   AuthName "Subversion Repository"
   AuthUserFile /etc/httpd/private/passwd.user
   AuthzSVNAccessFile /etc/httpd/private/svn.access
   Require valid-user
</Location>

設定帳號及權限:

/etc/httpd/private/passwd.user

mkdir -p /etc/httpd/private/
htpasswd2 -c -m /etc/httpd/private/passwd.user
chown apache /etc/httpd/private/passwd.user
chmod 600 /etc/httpd/private/passwd.user

/etc/httpd/private/svn.access:

[/]
candyz = rw
* = r

[/trunk]
candyz = rw
* =
chown apache /etc/httpd/private/svn.access
chmod 600 /etc/httpd/private/svn.access

svn import:

tar jxvf gcin-1.2.1.tar.bz2
mv gcin-1.2.1 gcin
svn import gcin http://ibook/svn/gcin/trunk -m "initial import for gcin-1.2.1" --username candyz
svn mkdir http://ibook/svn/gcin/tags -m "mkdir tags" --username candyz
svn mkdir http://ibook/svn/gcin/branches -m "mkdir branches" --username candyz
svn copy http://ibook/svn/gcin/trunk http://ibook/svn/gcin/tags/release-1.2.1 -m "Tagging the 1.2.1 release of gcin project." --username candyz
svn checkout http://ibook/svn/gcin/trunk gcin --username candyz
tar jxvf gcin-test.tbz
cp -a gcin-1.2.2/* gcin/
cd gcin
svn status
svn add config.h eggtrayicon.c tray.c eggtrayicon.h gcin-tray.png trad2sim gcin-tray-sim.png
svn commit -m "update to 1.2.2 preview version"
svn status
svn up

* 建立 Trac Environment:

mkdir -p /srv/trac
trac-admin /srv/trac/gcin initenv
chown -R apache.apache /srv/trac/gcin

* apache2 的設定:
編輯 /etc/httpd/conf.d/trac.conf:

<Location /trac>
   SetHandler mod_python
   PythonHandler trac.web.modpython_frontend
   PythonOption TracEnv /srv/trac/gcin
   PythonOption TracUriRoot /trac
</Location>
<Location /trac/login>
   AuthType Basic
   AuthName "trac"
   AuthUserFile /etc/httpd/private/passwd.user
   Require valid-user
</Location>

restart apache2:

sudo /etc/init.d/httpd restart

共同部份

* 設定 /srv/trac/gcin/conf/trac.ini:

[header_logo]
src = common/gcin.png
alt = Trac
height = 101
link = /trac/
width = 600

[logging]
log_file = trac.log
log_level = DEBUG
log_type = none

[trac]
default_charset = utf-8
ignore_auth_case = false
permission_store = DefaultPermissionStore
check_auth_ip = true
database = sqlite:db/trac.db
templates_dir = /usr/share/trac/templates
default_handler = WikiModule
metanav = login,logout,settings,help,about
mainnav = wiki,timeline,roadmap,tickets,newticket,search
repository_dir = /srv/svn/gcin

[notification]
always_notify_owner = false
smtp_always_cc =
smtp_password =
smtp_enabled = true
smtp_replyto = trac@localhost
smtp_port = 25
always_notify_reporter = false
smtp_server = localhost
smtp_from = trac@localhost
smtp_user =

[project]
url = http://ibook/
footer =  Visit the Trac open source project athttp://trac.edgewall.com/
name = gcin
descr = gcin project
icon = common/trac.ico

[mimeviewer]
php_path = php
enscript_path = enscript
tab_width = 8
max_preview_size = 262144

[attachment]
render_unsafe_content = false
max_size = 262144

[timeline]
changeset_show_files = 0
ticket_show_details = false
default_daysback = 30

[ticket]
default_version =
default_component = gcin
default_type = defect
restrict_owner = false
default_milestone =
default_priority = normal

[browser]
hide_properties = svk:merge

* 瀏覽 http://ibook/trac/

* trac-admin 工具程式

trac-admin /srv/trac/gcin

然後把 permission component priority version milestone 等設定一下

* 最後完成的快照:
trac

FireStats icon Powered by FireStats