Moya's Blog

About

慈濟大陸賑災、緬甸風災捐款: External link mark
郵政劃撥帳號-06692433
戶名-佛教慈濟基金會賑災專戶
(註明四川震災或緬甸風災)
慈濟捐款網站請按此 External link mark


處順境若能慈悲,則後福自在,仆逆境倘得智慧,則遺禍自消,於順境若能不喜,則後患不至,當逆境或能捨得,則福自踵來。此慈悲喜捨,便是大般涅槃無上妙法,入世行者或能三思。


《既然清淨,何必有網?》
《譬如大日,遍照不爽。》
《上下十方,無為自在;》
《因陀羅手,去曼達礙。》


靜思晨語系列 獅子吼大德 慈濟的好友 雅虎的好友 老骨頭級的朋友

07 Apr 2008 - 09:26 in tagged , by MoyaTseng
Trac 是一套目前發展的相當完整的專案管理系統,不過我還沒有真的花時間下去學習要怎麼用這一套系統就是了。

最近發現 TWiki 可以直接和 Trac 作架接的動作,看起來是個不錯的想法,所以打算來研究一下 Trac,以及如何架接 TWiki 與 Trac。以下是安裝 Trac 的步驟,僅供參考。

參考文件

  1. Using PostgreSQL as Trac Database External link mark
  2. Install Trac External link mark

注意事項 

  • 因為在 FreeBSD 上的 Python 對於 SQLite Thread 支援有問題,會 coredump / segment fault,所以選用 PostgreSQL 為資料庫

Required Packages

  1. 額外需要的認證機制相關套件
    1. /usr/ports/security/pwauth
    2. /usr/ports/www/mod_authnz_external
    3. /usr/ports/www/mod_authz_unixgroup
  2. SubVersion
  3. mod_fcgid
    1. cd /usr/ports/www/mod_python3
    2. make all install clean
    3. vi /usr/local/etc/apache22/extra/httpd-python3.conf
      LoadModule python_module libexec/apache22/mod_python.so
      
  4. python-2.5
    1. /var/db/ports/python25/options
      # This file is auto-generated by 'make config'.
      # No user-servicable parts inside!
      # Options for python25-2.5.2_1
      _OPTIONS_READ=python25-2.5.2_1
      WITH_THREADS=true
      WITH_HUGE_STACK_SIZE=true
      WITH_UCS4=true
      WITH_PYMALLOC=true
      WITHOUT_IPV6=true
      WITH_FPECTL=true
      
    2. cd /usr/ports/lang/python25
    3. make all install clean
  5. psycopg2
    1. cd /usr/ports/databases/py-psycopg2
    2. make all install clean

Install Trac

  1. cd /usr/ports/www/trac
  2. make all install clean

Config PostgreSQL database

  1. 建立帳號
    createuser -S -D -R -P -U pgsql trac
    
  2. 建立資料庫
    createdb -U pgsql -O trac trac
    

初始化專案

  1. 執行 trac-admin [/trac/project/home/path] initenv
    Creating a new Trac environment at [/trac/project/home/path]
    
    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]> [Project Name]
    
     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]> postgres://[username]:[password]@[hostname]/[database]
    
     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]> [project subversion repository path]
    
     Please enter location of Trac page templates.
     Default is the location of the site-wide templates installed with Trac.
    
    Templates directory [/usr/local/share/trac/templates]> 
    
    Creating and Initializing Project
     Installing default wiki pages
     /usr/local/share/trac/wiki-default/CamelCase => CamelCase
     /usr/local/share/trac/wiki-default/InterMapTxt => InterMapTxt
     /usr/local/share/trac/wiki-default/InterTrac => InterTrac
     /usr/local/share/trac/wiki-default/InterWiki => InterWiki
     /usr/local/share/trac/wiki-default/RecentChanges => RecentChanges
     /usr/local/share/trac/wiki-default/SandBox => SandBox
     /usr/local/share/trac/wiki-default/TitleIndex => TitleIndex
     /usr/local/share/trac/wiki-default/TracAccessibility => TracAccessibility
     /usr/local/share/trac/wiki-default/TracAdmin => TracAdmin
     /usr/local/share/trac/wiki-default/TracBackup => TracBackup
     /usr/local/share/trac/wiki-default/TracBrowser => TracBrowser
     /usr/local/share/trac/wiki-default/TracCgi => TracCgi
     /usr/local/share/trac/wiki-default/TracChangeset => TracChangeset
     /usr/local/share/trac/wiki-default/TracEnvironment => TracEnvironment
     /usr/local/share/trac/wiki-default/TracFastCgi => TracFastCgi
     /usr/local/share/trac/wiki-default/TracGuide => TracGuide
     /usr/local/share/trac/wiki-default/TracImport => TracImport
     /usr/local/share/trac/wiki-default/TracIni => TracIni
     /usr/local/share/trac/wiki-default/TracInstall => TracInstall
     /usr/local/share/trac/wiki-default/TracInterfaceCustomization => TracInterfaceCustomization
     /usr/local/share/trac/wiki-default/TracLinks => TracLinks
     /usr/local/share/trac/wiki-default/TracLogging => TracLogging
     /usr/local/share/trac/wiki-default/TracModPython => TracModPython
     /usr/local/share/trac/wiki-default/TracNotification => TracNotification
     /usr/local/share/trac/wiki-default/TracPermissions => TracPermissions
     /usr/local/share/trac/wiki-default/TracPlugins => TracPlugins
     /usr/local/share/trac/wiki-default/TracQuery => TracQuery
     /usr/local/share/trac/wiki-default/TracReports => TracReports
     /usr/local/share/trac/wiki-default/TracRevisionLog => TracRevisionLog
     /usr/local/share/trac/wiki-default/TracRoadmap => TracRoadmap
     /usr/local/share/trac/wiki-default/TracRss => TracRss
     /usr/local/share/trac/wiki-default/TracSearch => TracSearch
     /usr/local/share/trac/wiki-default/TracStandalone => TracStandalone
     /usr/local/share/trac/wiki-default/TracSupport => TracSupport
     /usr/local/share/trac/wiki-default/TracSyntaxColoring => TracSyntaxColoring
     /usr/local/share/trac/wiki-default/TracTickets => TracTickets
     /usr/local/share/trac/wiki-default/TracTicketsCustomFields => TracTicketsCustomFields
     /usr/local/share/trac/wiki-default/TracTimeline => TracTimeline
     /usr/local/share/trac/wiki-default/TracUnicode => TracUnicode
     /usr/local/share/trac/wiki-default/TracUpgrade => TracUpgrade
     /usr/local/share/trac/wiki-default/TracWiki => TracWiki
     /usr/local/share/trac/wiki-default/WikiDeletePage => WikiDeletePage
     /usr/local/share/trac/wiki-default/WikiFormatting => WikiFormatting
     /usr/local/share/trac/wiki-default/WikiHtml => WikiHtml
     /usr/local/share/trac/wiki-default/WikiMacros => WikiMacros
     /usr/local/share/trac/wiki-default/WikiNewPage => WikiNewPage
     /usr/local/share/trac/wiki-default/WikiPageNames => WikiPageNames
     /usr/local/share/trac/wiki-default/WikiProcessors => WikiProcessors
     /usr/local/share/trac/wiki-default/WikiRestructuredText => WikiRestructuredText
     /usr/local/share/trac/wiki-default/WikiRestructuredTextLinks => WikiRestructuredTextLinks
     /usr/local/share/trac/wiki-default/WikiStart => WikiStart
     Indexing repository
     [2]
    ---------------------------------------------------------------------
    Project environment for '[Project Name]' created.
    
    You may now configure the environment by editing the file:
    
      [/trac/project/home/path]/conf/trac.ini
    
    If you'd like to take this new project environment for a test drive,
    try running the Trac standalone web server `tracd`:
    
      tracd --port 8000 [/trac/project/home/path]
    
    Then point your browser to http://localhost:8000/dlife.
    There you can also browse the documentation for your installed
    version of Trac, including information on further setup (such as
    deploying Trac to a real web server).
    
    The latest documentation can also always be found on the project
    website:
    
      http://trac.edgewall.org/
    
    Congratulations!
    

啟用 Cache 功能

  1. mkdir /usr/local/share/trac/cache
  2. chown www:www /usr/local/share/trac/cache
  3. 在 apache22 的設定當中加上 cache 的設定
    SetEnv PYTHON_EGG_CACHE /usr/local/share/trac/cache
    

Config Apache22

  1. /usr/local/etc/apache22/httpd.conf
    # Python
    Include etc/apache22/extra/httpd-python3.conf
    
  2. /usr/local/etc/apache22/extra/httpd-python3.conf
    LoadModule python_module libexec/apache22/mod_python.so
    
  3. /usr/local/etc/apache22/vhosts/trac.conf
    <VirtualHost *:80>
      ServerName [hostname]
      ServerAdmin [admin email address]
      DocumentRoot /usr/local/share/trac/htdocs
    
      AddExternalAuth trac_pwauth /usr/local/bin/pwauth
      SetExternalAuthMethod trac_pwauth pipe
    
      <Directory "/usr/local/share/trac/htdocs">
        Order allow,deny
        Allow from all
      </Directory>
    
    # For testing mod_python only
    #  <Location /mpinfo>
    #    SetHandler mod_python
    #    PythonInterpreter main_interpreter
    #    PythonHandler mod_python.testhandler
    #  </Location>
    
      <Location />
        SetHandler mod_python
        PythonInterpreter main_interpreter
        PythonHandler trac.web.modpython_frontend 
        PythonOption TracEnvParentDir /home/trac
        PythonOption TracUriRoot /
        # 啟用 Egg Cache 功能
        SetEnv PYTHON_EGG_CACHE /usr/local/share/trac/cache
      </Location>
    
      Alias /css "/usr/local/share/trac/htdocs/css"
      Alias /js "/usr/local/share/trac/htdocs/js"
    
      <Location /css>
        SetHandler None
      </Location>
    
      <Location /js>
        SetHandler None
      </Location>
    
      <Location /login>
        AuthType Basic           
        AuthName "Trac Project Authorize"
        AuthBasicProvider external
        AuthExternal trac_pwauth
    
        AuthzUnixgroup on 
        Require group trac
    
        Order allow,deny
        Allow from All 
        AllowOverride All
      </Location>
    
    </VirtualHost>
    

初始化 Trac.ini

  1. 參考文件
    1. TracIni External link mark
  2. path
    /usr/local/share/trac/conf/trac.ini
    

安裝 Trac Plugins

  1. setuptools
    1. cd /usr/ports/devel/py-setuptools
    2. make all install clean
  2. WebAdmin Plugin
    1. 安裝
      /usr/local/bin/easy_install http://svn.edgewall.com/repos/trac/sandbox/webadmin/
      
    2. 安裝好的檔案
      /usr/local/lib/python2.5/site-packages/TracWebAdmin-0.1.2dev_r5911-py2.5.egg
      
    3. 啟用 WebAdmin Plugin,設定 /usr/local/share/trac/conf/trac.ini
      [components]
      webadmin.* = enable
      
  3. Theme Engine Plugin
    1. 安裝
      /usr/local/bin/easy_install http://trac-hacks.org/svn/themeengineplugin
      


Leave a Reply

You may have to login or register to comment if you haven't already.

訪客統計: 3762 人次



請按此訂閱每日人間菩提。靜思晨語 External link mark
本站所有言論均不代表慈濟基金會 External link mark


我為你祝福
我也要許願

r1 – 07 Apr 2008 – 09:28:49 – Main.MoyaTseng
Copyright © 1999-2009 by the contributing authors. All material on this collaboration platform is the property of the contributing authors. Ideas, requests, problems regarding Moya's Blog? Send feedback.