Monday, 18 September 2006

Getting Started with Subversion - Trac

Subversion无痛起步 --- Trac 0.10b1 + Apache 2


开始之前,当然是下载、安装所需要的软件。Apache 2和Subversion,在前面已经作了介绍。

0. Install Apache 2.0.59/2.2.3 into Windows, and make sure it works;
1. Install Subversion 1.4.0, and add C:\Program Files\Subversion\bin
into the system PATH;

Trac是Python程序,安装Python必不可少。其它需要的组件有PySQLite(提供数据库支持),clearsilver(web page template),svn-python以及Trac本身。

2. Download ActivePython 2.4.3 and install;
3. Confirm C:\...\Python24\Scripts in the system PATH;
4. Download PySQLite 2.3.2 and install;
5. Download clearsilver-0.9.14.win32-py2.4.exe and install;
6. Download the SVN-Python bindings - svn-python-1.4.0-py2.4.exe
and install;
7. Download trac-0.10b1.win32.exe and install;


8. Change some file names
Python24\Scripts\trac-admin --> Python24\Scripts\
Python24\Scripts\tracd --> Python24\Scripts\
Python24\Scripts\tracdb2env --> Python24\Scripts\


9. CMD, mkdir C:\tracroot. Then, cd C:\tracroot;

在建立好相应的Subversion Repository之后,建立一个Demo Trac示范项目。

10. Creating a demo project environment. Need to type the project name
and the path of the current svn repository only. Here is the log of
run time;
C:\tracroot>trac-admin demotrac initenv
Creating a new Trac environment at C:\tracroot\demotrac
Project Name [My Project]> Demo Trac
Database connection string [sqlite:db/trac.db]>
Repository type [svn]>
Path to repository [/path/to/repos]> C:\svnroot\demosvn
Templates directory [C:\...\Python24\share\trac\templates]>
Creating and Initializing Project
Installing default wiki pages
Indexing repository

Project environment for 'Demo Trac' created.

You may now configure the environment by editing the file:


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 C:\tracroot\demotrac

Then point your browser to http://localhost:8000/demotrac.
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




11. In the last step, we set up;
Project Path: C:\tracroot\demotrac
Database Type: sqlite
Database File: C:\tracroot\demotrac\db\trac.db
Config File: C:\tracroot\demotrac\conf\trac.ini
Repository: C:\svnroot\demosvn


12. Edit trac.ini;
link = http://localhost:8000/demotrac

descr = My Demo Trac Project
url = http://localhost:8000/demotrac

以单机模式运行Trac Server。

13. Run the demo trac in the standalone mode;
C:\tracroot>tracd --port 8000 C:\tracroot\demotrac


14. Now, access http://localhost:8000 and http://localhost:8000/demotrac
in the browser;

单机模式下的Trac Server,需要这样停下来。

15. How to stop the tracd? CMD, ctrl-c and refresh the web page in
the browser;

为了和Apache 2进行整合,再次修改配置文件。

16. Modify trac.ini;
link = http://localhost/demotrac

url = http://localhost/demotrac

在Trac中,是通过调用Flup模块来实现SCGI & AJP Service。如果Python中已安装Flup模块,那就可以让Trac项目以SCGI模式运行。

17. Start the tracd in the SCGI service mode;
C:\tracroot>tracd --port 8000 --protocol=scgi C:\tracroot\demotrac

Apache 2的配置文件,当然也需要作相应的调整。

18. Modify the httpd.conf of Apache 2 to configure the SCGI module;
LoadModule scgi_module modules/

<IfModule mod_scgi.c>
SCGIMount /demotrac

重新启动Apache 2,访问http://localhost/demotrac,整合成功。

19. Restart Apache 2, access http://localhost/demotrac in the browser;


20. Start tracd from the parent path;
C:\tracroot>tracd --port 8000 --protocol=scgi -e C:\tracroot
21. Map the two folders to the same SCGI port;
<IfModule mod_scgi.c>
SCGIMount /demotrac
SCGIMount /foo


Q & A
Q: Why Trac 0.10b1?
A: In Trac 0.10b1, WSGI used as web server protocol.

Q: Apache 2.0.59/2.2.3, does both work with Trac?
A: Yes, Apache will connect to Trac via by the SCGI protocol. It is the
most easy way.

Q: How about the authentication and authorization options?
A: The configuration files in PART II can be used in Trac.


At 08 February, 2007 01:47, Anonymous Anonymous said...


At 13 March, 2007 23:16, Blogger OneZ said...

My pleasure


Post a Comment

<< Home