【翻译】在ubuntu上安装Trac

话说安装trac这事已经是很久以前就玩过了,今天在我的s10上安装trac却突然一下大脑短路,想不起来第一步怎么弄。。于是google了一下,发现trac官网上就有安装手册,于是看了一下……结果我发现我以前玩trac的时候走了不知道多少的弯路,官方提供的方法实在是简单。翻译备份一下。

我的环境:ubuntu 8.10 + Trac 0.11.3

我觉得没必要翻译的内容就没翻译了,原文见:
http://trac.edgewall.org/wiki/0.11/TracOnUbuntu

以下为翻译:

首先确保你的软硬件没问题(略)。

1,安装软件包

要装trac之前,先装apache、setuptools和一些库:

[code]
sudo apt-get install apache2 libapache2-mod-python
libapache2-svn python-setuptools subversion python-subversion
sudo easy_install Trac
[/code]

如果想安装Bitten for trac(Tang:不清楚这是啥,放这里吧):
[code]
# Needed for bitten's trac 10.4 compatiblity.
sudo apt-get install python-clearsilver
# Needed for bitten unitest.
sudo easy_install http://darcs.idyll.org/~t/projects/figleaf-latest.tar.gz
[/code]

2,创建Trac根目录

你需要为trac创建一个运行环境目录,并且apache对这个目录是可读写的:

[code]
sudo mkdir /var/lib/trac
sudo chown www-data:www-data /var/lib/trac
[/code]

3,安装apache

接下来,创建一个apache2的虚拟主机:

[code]
sudo vi /etc/apache2/sites-available/trac
[/code]

然后把下面的内容复制到这个文件中:

[code]
ServerAdmin webmaster@localhost
ServerName trac.example.com
DocumentRoot /var/www
ErrorLog /var/log/apache2/error.trac.log
CustomLog /var/log/apache2/access.trac.log combined

SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /var/lib/trac
PythonOption TracUriRoot /projects
PythonOption PYTHON_EGG_CACHE /tmp

# use the following for one authorization for all projects
# (names containing "-" are not detected):

AuthType Basic
AuthName "trac"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
[/code]

Tang:这里的验证设置是针对projects下的所有的trac项目的,如果要针对不同的项目设置,可以创建多个不同的LocationMatch。例如,我有两个项目,一个叫yun,一个叫bin,分别使用yun.htpasswd和bin.htpasswd作为验证,则LocationMatch部分可以写成:

[code lang="XML"]

AuthType Basic
AuthName "trac"
AuthUserFile /etc/apache2/yun.passwd
Require valid-user

AuthType Basic
AuthName "trac"
AuthUserFile /etc/apache2/bin.passwd
Require valid-user
[/code]

其中AuthName是显示在登陆面板上的文字。

然后,停止默认的虚拟机,启动刚才创建的虚拟机,并重新加载apache2配置:
[code]
sudo a2dissite default
sudo a2ensite trac
sudo /etc/init.d/apache2 reload
[/code]

Tang:官方的介绍这里使用了新建虚拟机文件,实际上直接把上面的设置放在httpd.conf或者default文件中都是可以的,在公司的服务器上我便全是直接修改httpd.conf文件。

4,创建环境
SVN

我将Subversion库安装到/var/lib/svn/YourProjectNameHere(Tang:实际上我是安装到/var/svn/libs路径的,这是我个人的习惯,上面路径是原文的内容)。用下面的命令快速配置SVN:

[code]
sudo mkdir /var/lib/svn
sudo svnadmin create /var/lib/svn/YourProjectNameHere
[/code]

然后修改一下权限,并重新加载apache2配置:

[code]
sudo chown -R www-data /var/lib/svn
sudo chown -R www-data /usr/share/trac
sudo /etc/init.d/apache2 reload
[/code]

Trac

我将trac环境放置在/var/lib/trac/YourProjectNameHere。当然你可以使用你自己喜欢的路径和名称。然后执行:
[code]
sudo mkdir /var/lib/trac
sudo trac-admin /var/lib/trac/YourProjectNameHere initenv
sudo chown -R www-data /var/lib/trac
[/code]

命令”trac-admin”会让你输入一些初始化的信息:
the project name (这里输入你的项目名称)
the path to svn repository (这里输入SVN库的路径)
其他的,直接回车就可以了。

如果最后看到congratulations,这个环境已经完成了。现在你的项目地址在http://servername/projects

5,让SVN工作起来

你需要修改一下这个文件:
[code]
/etc/apache2/mods-available/dav_svn.conf
[/code]

将下面两行注释的内容取消注释:
[code lang="XML"]
# Uncomment this to enable the repository,
DAV svn
# Set this to the path to your repository
SVNParentPath /var/lib/svn
[/code]

6,一些插件

使用apt-get安装的插件:

[code]
sudo apt-get install build-essential graphviz
sudo apt-get install htmldoc
sudo apt-get install enscript
[/code]
使用Easy_install安装的插件:

[code]
sudo easy_install http://svn.edgewall.org/repos/genshi/trunk/
sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk
sudo easy_install http://trac-hacks.org/svn/customfieldadminplugin/0.11
sudo easy_install http://trac-hacks.org/svn/eclipsetracplugin/tracrpcext/0.10
sudo easy_install http://trac-hacks.org/svn/iniadminplugin/0.11
sudo easy_install http://trac-hacks.org/svn/masterticketsplugin/0.11
sudo easy_install http://trac-hacks.org/svn/pagetopdfplugin/0.10/
sudo easy_install http://trac-hacks.org/svn/progressmetermacro/0.11
sudo easy_install http://trac-hacks.org/svn/ticketdeleteplugin/0.11
sudo easy_install http://trac-hacks.org/svn/tracwysiwygplugin/0.11
sudo easy_install http://wikinotification.ufsoft.org/svn/trunk
[/code]

7,如果没有很好的运行,你可以看看以下的内容:

密码验证文件是需要www-data能读写的:
[code]
me@ubuntu:~$ ls -l /etc/apache2/dav_svn.passwd
-rw-r--r-- 1 www-data root 21 2008-09-23 21:03 /etc/apache2/dav_svn.passwd
me@ubuntu:~$
[/code]

看看trac的安装目录:
[code]
me@ubuntu:~$ tree -as /var/lib/trac/
/var/lib/trac/
`-- [ 4096] YourProjectNameHere
|-- [ 98] README
|-- [ 27] VERSION
|-- [ 4096] attachments
|-- [ 4096] conf
| |-- [ 7025] trac.ini
| |-- [ 4755] trac.ini.new
| `-- [ 4187] trac.ini.sample
|-- [ 4096] db
| |-- [ 349184] trac.db
| `-- [ 324608] trac.db.21.bak
|-- [ 4096] htdocs
|-- [ 4096] log
| `-- [ 84562] trac.log
|-- [ 4096] plugins
| `-- [ 4096] TracWebAdmin-0.1.2dev-py2.5.egg
| |-- [ 4096] EGG-INFO
| | |-- [ 278] PKG-INFO
| | |-- [ 335] SOURCES.txt
| | |-- [ 1] dependency_links.txt
| | |-- [ 218] entry_points.txt
| | |-- [ 1] not-zip-safe
| | `-- [ 9] top_level.txt
| `-- [ 4096] webadmin
| |-- [ 523] __init__.py
| |-- [ 218] __init__.pyc
| |-- [ 1594] basics.py
| |-- [ 1682] basics.pyc
| |-- [ 4096] htdocs
| | |-- [ 4096] css
| | | `-- [ 1900] admin.css
| | |-- [ 4096] img
| | | |-- [ 218] collapsed.png
| | | `-- [ 227] expanded.png
| | `-- [ 4096] js
| | `-- [ 1286] admin.js
| |-- [ 3930] logging.py
| |-- [ 3133] logging.pyc
| |-- [ 2659] perm.py
| |-- [ 2585] perm.pyc
| |-- [ 9247] plugin.py
| |-- [ 8720] plugin.pyc
| |-- [ 4096] templates
| | |-- [ 954] admin.cs
| | |-- [ 685] admin_basics.cs
| | |-- [ 2961] admin_component.cs
| | |-- [ 2202] admin_enum.cs
| | |-- [ 1669] admin_log.cs
| | |-- [ 3898] admin_milestone.cs
| | |-- [ 1521] admin_perm.cs
| | |-- [ 3167] admin_plugin.cs
| | `-- [ 2901] admin_version.cs
| |-- [ 16312] ticket.py
| |-- [ 13250] ticket.pyc
| |-- [ 5579] web_ui.py
| `-- [ 6505] web_ui.pyc
|-- [ 4096] snapshots
`-- [ 4096] templates
`-- [ 151] site.html
[/code]

17 directories, 42 files
me@ubuntu:~$

看看安装的插件:
[code]
me@ubuntu:~$ ls -d /usr/lib/python2.5/site-packages/*.egg
/usr/lib/python2.5/site-packages/Bitten-0.6dev_r559-py2.5.egg
/usr/lib/python2.5/site-packages/Genshi-0.5.1-py2.5-linux-i686.egg
/usr/lib/python2.5/site-packages/Genshi-0.6dev_r960-py2.5-linux-i686.egg
/usr/lib/python2.5/site-packages/IniAdmin-0.2-py2.5.egg
/usr/lib/python2.5/site-packages/Trac-0.11.1-py2.5.egg
/usr/lib/python2.5/site-packages/TracAccountManager-0.2.1dev_r3857-py2.5.egg
/usr/lib/python2.5/site-packages/TracCustomFieldAdmin-0.2-py2.5.egg
/usr/lib/python2.5/site-packages/TracExtendedXmlRpc-0.1-py2.5.egg
/usr/lib/python2.5/site-packages/TracMasterTickets-2.1.3-py2.5.egg
/usr/lib/python2.5/site-packages/TracPageToPDF-0.2-py2.5.egg
/usr/lib/python2.5/site-packages/TracProgressMeterMacro-0.1-py2.5.egg
/usr/lib/python2.5/site-packages/TracTicketDelete-2.0-py2.5.egg
/usr/lib/python2.5/site-packages/TracWebAdmin-0.1.2dev-py2.5.egg
/usr/lib/python2.5/site-packages/TracWikiNotification-0.2.0-py2.5.egg
/usr/lib/python2.5/site-packages/TracWysiwyg-0.2_r4214-py2.5.egg
me@ubuntu:~$
[/code]

3 comments to 【翻译】在ubuntu上安装Trac

  • [...] 之前已经多次在ubuntu上安装trac,但是还没有在debian上安装过。今天开始在debian上安装,按照之前的经验,在ubuntu上安装trac,其他一切都好,但是在打开trac页面的时候总是出现500错误,查看log也是一头雾水,看不明白。后来在Trac的官网上瞎逛,发现这个:TracOnDebian,原来在debian上安装trac是不需要通过easy_install的,直接apt-get,很方便。 [...]

  • [...] Debian安装Trac 2009/07/03 13:52   No comment   Apache, debian, SVN, Trac, Ubuntu   之前已经多次在Ubuntu上安装trac,但是还没有在Debian上安装过。今天开始在Debian上安装,按照之前的经验,在ubuntu上安装trac,其他一切都好,但是在打开trac页面的时候总是出现500错误,查看log也是一头雾水,看不明白。后来在Trac的官网上瞎逛,发现这个:TracOnDebian,原来在Debian上安装trac是不需要通过easy_install的,直接apt-get,很方便。 [...]

  • [...] Debian安装Trac 2009/07/03 13:52   [0]   Apache, debian, SVN, Trac, Ubuntu   之前已经多次在ubuntu上安装trac,但是还没有在debian上安装过。今天开始在debian上安装,按照之前的经验,在ubuntu上安装trac,其他一切都好,但是在打开trac页面的时候总是出现500错误,查看log也是一头雾水,看不明白。后来在Trac的官网上瞎逛,发现这个:TracOnDebian,原来在debian上安装trac是不需要通过easy_install的,直接apt-get,很方便。 [...]

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Hello world

Hi,我是Tang Bin,finalbug.org是我的个人站点。这里有更多关于我的内容。English readers please click here to learn more about me and this site.

Categories