Changes between Version 3 and Version 4 of waue/Trac


Ignore:
Timestamp:
Feb 10, 2009, 11:52:22 AM (15 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • waue/Trac

    v3 v4  
    11[[PageOutline]]
    22
    3 = Trac on Ubuntu =
     3= Trac 安裝實務 =
     4紀錄用Trac 安裝於 Ubuntu的步驟
    45
    5 == 緣由 ==
    6 由於Jazz大力推薦,使用Trac已經好一陣子,覺得是一個不錯的文件工作管理系統。不過都用Jazz架好的系統,也想要自己試一下怎麼安裝架設。除此之外,trac的預設CSS還有更符合個人瀏覽習慣的改進空間,加上一些trac的plug in也想試試看。 我的安裝環境於 Ubuntu 8.04 & trac 0.11,參考主要是官方網站:
    7 
    8 [http://trac.edgewall.org/wiki/TracInstallPlatforms 安裝Trac於各種不同作業系統的HowTo]
    9 
    10 雖然官網介紹得很詳盡,不過還是有些小細節要注意,安裝方法如下:
    11 
    12 = 環境參數 =
    13 
    14 == 查看 Ubuntu 機器資訊 ==
    15 {{{
    16 waue@ubuntu:~$ cat /etc/lsb-release
    17 DISTRIB_ID=Ubuntu
    18 DISTRIB_RELEASE=8.04
    19 DISTRIB_CODENAME=hardy
    20 DISTRIB_DESCRIPTION="Ubuntu 8.04.1"
    21 waue@ubuntu:~$
    22 
    23 }}}
    24 
    25 == 環境路徑 ==
    26 以下內容會用到的路徑統一在此作說明解釋
    27 
    28 || 名稱 || 目錄 ||
    29 || Trac專案根目錄 || /var/lib/trac ||
    30 || Trac專案項目目錄 || /var/lib/trac/waue ||
    31 || 瀏覽目錄 || http://gm1.nchc.org.tw/waue ||
    32 || 版本控制跟目錄 || /var/lib/svn ||
    33 
    34 = Trac 0.11 安裝 =
    35 == 1. 軟體套件 ==
    36 
    37 
    38 安裝 apache, setuptools and some libraries:
    39 
    40 {{{
    41 sudo apt-get install apache2 libapache2-mod-python \
    42      libapache2-svn python-setuptools subversion python-subversion
    43 sudo easy_install Trac
    44 }}}
    45 
    46 === 若要安裝 Bitten  ===
    47 雖然是選項,但我有安裝。
    48 
    49 {{{
    50 # Needed for bitten's trac 10.4 compatiblity.
    51 sudo apt-get install python-clearsilver
    52 # Needed for bitten unitest.
    53 sudo easy_install http://darcs.idyll.org/~t/projects/figleaf-latest.tar.gz
    54 
    55 }}}
    56 
    57 == 2. 新增 Trac 環境目錄 ==
    58 
    59 設定此目錄可以讓apache有讀寫權限
    60 
    61 {{{
    62 sudo mkdir /var/lib/trac
    63 sudo chown www-data:www-data /var/lib/trac
    64 }}}
    65 
    66 == 3. 設定 Apache2 ==
    67 
    68 接下來是設定trac整合到apache的步驟,先創立一個trac模型
    69 
    70 {{{
    71 sudo vi /etc/apache2/sites-available/trac
    72 }}}
    73 
    74 填入此模型的內容
    75 
    76 {{{
    77 <VirtualHost *>
    78         ServerAdmin waue0920@gmail.com
    79         ServerName gm1.nchc.org.tw
    80         DocumentRoot /var/www
    81         ErrorLog /var/log/apache2/error.trac.log
    82         CustomLog /var/log/apache2/access.trac.log combined
    83 
    84         <Location /waue>
    85                 SetHandler mod_python
    86                 PythonInterpreter main_interpreter
    87                 PythonHandler trac.web.modpython_frontend
    88                 PythonOption TracEnvParentDir /var/lib/trac
    89                 PythonOption TracUriRoot /waue
    90                 PythonOption PYTHON_EGG_CACHE /tmp
    91         </Location>
    92 
    93         # use the following for one authorization for all projects
    94         # (names containing "-" are not detected):
    95         <LocationMatch "/waue/[[:alnum:]]+/login">
    96             AuthType Basic
    97             AuthName "trac"
    98             AuthUserFile /etc/apache2/dav_svn.passwd
    99             Require valid-user
    100         </LocationMatch>
    101 
    102 </VirtualHost>
    103 }}}
    104 
    105 然後,取消default模板,換成剛剛的trac模板,然後重新啟動apache
    106 
    107 {{{
    108 sudo a2dissite default
    109 sudo a2ensite trac
    110 sudo  /etc/init.d/apache2 reload
    111 }}}
    112 
    113 
    114 == 4. 啟動 ==
    115 === SVN ===
    116 讓trac有版本控制的功能:
    117 {{{
    118 sudo mkdir /var/lib/svn
    119 sudo svnadmin create /var/lib/svn/waue
    120 }}}
    121 
    122 增加apache可以存取的目錄權限:
    123 {{{
    124 sudo chown -R www-data /var/lib/svn
    125 sudo chown -R www-data /usr/share/trac
    126 sudo  /etc/init.d/apache2 reload
    127 }}}
    128 
    129 ps: References: [http://abbeyworkshop.com/howto/misc/svn01/ Commands populate files into SVN repository]
    130 
    131 === Mercurial ===
    132 
    133 沒裝,不知道效果,原文如下:
    134 
    135 An alternate solution is to use mercurial. if this case, do not setup any SVN (of course), indicate hg as the type of version control tool and the folder were your mercurial is. You will also need the mercurial plugin [wiki:TracMercurial Trac Mercurial] and the lastest version of mercurial from [https://help.ubuntu.com/community/UbuntuBackports#How%20to%20use the backports]
    136 
    137 === Trac ===
    138 {{{/var/lib/trac/waue}}}是我trac中的專案路徑,更改其權限
    139 
    140 {{{
    141 sudo mkdir /var/lib/trac
    142 sudo trac-admin /var/lib/trac/waue initenv
    143 }}}
    144 
    145 執行trac-admin這個指令會有query詢問環境參數如何設定:
    146 
    147  * Project Name [My Project]>''' {{{waue}}} '''
    148  * Database connection string [sqlite:db/trac.db]> ''' [Enter鍵] '''
    149  * Repository type [svn]> ''' [Enter鍵] '''
    150  * Path to repository [/path/to/repos]> ''' /var/lib/trac/waue '''
    151 
    152 接著設定權限
    153 {{{
    154 sudo chown -R www-data /var/lib/trac
    155 }}}
    156 
    157 
    158 接著在瀏覽器輸入你的網址http://localhost/waue就可以看到囉!
    159  '''!http://localhost/waue'''
    160 
    161 更完整的Mod_Python設定,可以看 [http://trac.edgewall.org/wiki/TracModPython TracModPython]
    162 
    163 
    164 == 5. 設定svn ==
    165 修改 {{{/etc/apache2/mods-available/dav_svn.conf}}}
    166 
    167 {{{ 
    168 <Location /svn>
    169     # Uncomment this to enable the repository,
    170     DAV svn
    171 
    172     # Set this to the path to your repository
    173     SVNParentPath /var/lib/svn
    174 </Location>
    175 }}}
    176 
    177 
    178 == 6. Plugin ==
    179 
    180 === apt-get trac plugins  ===
    181 {{{
    182 
    183 sudo apt-get install build-essential graphviz htmldoc enscript
    184 }}}
    185 === Easy_install Trac plugins ===
    186 {{{
    187 sudo easy_install http://svn.edgewall.org/repos/genshi/trunk/
    188 sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk
    189 sudo easy_install http://trac-hacks.org/svn/customfieldadminplugin/0.11
    190 sudo easy_install http://trac-hacks.org/svn/eclipsetracplugin/tracrpcext/0.10
    191 sudo easy_install http://trac-hacks.org/svn/iniadminplugin/0.11
    192 sudo easy_install http://trac-hacks.org/svn/masterticketsplugin/0.11
    193 sudo easy_install http://trac-hacks.org/svn/pagetopdfplugin/0.10/
    194 sudo easy_install http://trac-hacks.org/svn/progressmetermacro/0.11
    195 sudo easy_install http://trac-hacks.org/svn/ticketdeleteplugin/0.11
    196 sudo easy_install http://trac-hacks.org/svn/tracwysiwygplugin/0.11
    197 sudo easy_install http://wikinotification.ufsoft.org/svn/trunk
    198 }}}
    199  
    200 == 7. Adding Authentication ==
    201 
    202 === 權限設定 ===
    203 用 `htpasswd -c` 來創建 password 檔:
    204 
    205 {{{
    206 $ htpasswd -c /etc/apache2/dav_svn.passwd admin
    207 New password: <type password>
    208 Re-type new password: <type password again>
    209 Adding password for user admin
    210 }}}
    211 
    212 增加使用者也是用htpasswd,但不要加參數 "-c"
    213 {{{
    214 $ htpasswd /etc/apache2/dav_svn.passwd waue
    215 New password: <type password>
    216 Re-type new password: <type password again>
    217 Adding password for user waue
    218 }}}
    219 
    220 設定Trac的login到Apache的模型(sudo vi /etc/apache2/sites-available/trac):
    221 {{{
    222 <Location "/trac/login">
    223   AuthType Basic
    224   AuthName "Trac"
    225   AuthUserFile /etc/apache2/dav_svn.passwd
    226   Require valid-user
    227 </Location>
    228 }}}
    229 
    230 === 多個專案 ===
    231 
    232 如果你有很多的project要管理,可以用下面的方法來設定多個專案:
    233 {{{
    234 <LocationMatch "/trac/[^/]+/login">
    235   AuthType Basic
    236   AuthName "Trac"
    237   AuthUserFile /etc/apache2/dav_svn.passwd
    238   Require valid-user
    239 </LocationMatch>
    240 }}}
    241 
    242 === 更安全的作法 ===
    243 安全因素考量,建立SSL連線;或AuthType用「Digest」代替 「Basic」. 更多 [http://httpd.apache.org/docs/2.0/ Apache HTTPD documentation] 。
    244 
    245 {{{
    246 <Location "/trac/login">
    247     LoadModule auth_digest_module /usr/lib/apache2/modules/mod_auth_digest.so
    248     AuthType Digest
    249     AuthName "trac"
    250     AuthDigestDomain /trac
    251     AuthUserFile /etc/apache2/dav_svn.passwd
    252     Require valid-user
    253 </Location>
    254 }}}
    255 新增 .htpasswd file with htdigest instead of htpasswd as follows:
    256 {{{
    257 # htdigest /etc/apache2/dav_svn.passwd trac admin
    258 }}}
    259 where the "trac" parameter above is the same as !AuthName above  ("Realm" in apache-docs).
    260 
    261 {{{
    262 sudo chown www-data /etc/apache2/dav_svn.passwd
    263 }}}
    264 
     6= Trac 的專案移植 =
     7紀錄將一整個專案移植到另一台主機上運行