work, study, life ..........

Monday, July 21, 2008

Integration for Trac 、SVN 、Berkeley DB 、Sqlite

Date: Jan 11, 2008

Author: qing

Platform OS Red Hat Enterprise Linux AS release 4 (Nahant Update 2)

Install or Upgrade Python (Option, but The version of Python is equivalent to more than 2.3 at least);

$ ./configure –prefix=/path/to/python –enable-shared –with-pth –enable-shared –enable-profiling

$ make

# make install

AAA: Please create python.conf in /etc/ld.so.conf.d directory,and edit it:

/path/to/python/lib

Then run:

# ldconfig

1. Berkeley DB(db-4.2.52) installation:

# cd db-4.2.52

# patch -p0 <>

# patch -p0 <>

# patch -p0 <>

# patch -p0 <>

# patch -p0 <>

# cd build_unix

# ../dist/configure –prefix=/path/to/db

# make

# make install

2. Apache (httpd-2.0.61)

# ./configure –prefix=/path/to/httpd –enable-modules=all –enable-mods-shared=most –enable-so –with-berkeley-db=/path/to/db –with-dbm=db42

# make

# make install

3. svn (subversion-1.4.3)

# ./configure –prefix=/path/to/subversion –with-apxs=/path/to/httpd/bin/apxs –with-apr=/path/to/httpd/bin/apr-config –with-apr-util=/path/to/http/bin/apu-config –with-berkeley-db=/path/to/db -without-neon

Note: Please add ”-without-neon” parameter.

# make

# make swig-py

# make install

# make install-swig-py

# echo “/path/to/svn/lib/svn-python” > /path/to/python/lib/python2.5/site-packages/subversion.pth

As above AAA operation;

# export PYTHONPATH=$PYTHONPATH:/path/to/subversion/lib/svn-python

Detail operation please to see: http://trac.edgewall.org/wiki/TracSubversion

4. sqlite (sqlite-3.5.4)

# ./configure –prefix=/path/to/sqlite –disable-tcl –enable-threadsafe

# make

# make install

As above AAA operation;

5. Install pysqlite (pysqlite-2.3.5)

PySqlite is a Python binding for the SQLite light-weight database engine, which is Trac’s default DatabaseBackend.

first, please edit setup.cfg in pysqlite source directory:

[build_ext]

define=

include_dirs=/path/to/sqlite/include

library_dirs=/path/to/sqlite/lib

libraries=sqlite3

second, execute following directiver:

# python setup.py build

# python setup.py install

We can see following messages:

“copying build/lib.linux-i686-2.5/pysqlite2/_sqlite.so -> /path/to/python/lib/python2.5/site-packages/pysqlite2

running install_egg_info

Writing /path/python/lib/python2.5/site-packages/pysqlite-2.3.5-py2.5.egg-info”

About detailed pysqlite install document, please see:

http://trac.edgewall.org/wiki/PySqlite

I got a error - “ValueError: database parameter must be string or APSW Connection object” , while was creating trac db. because of I’m using version 2.4.0 for pysqlite in this environment.

6. Flex (flex-2.5.34)

# ./configure –prefix=/path/to/flex –with-libiconv-prefix=/path/to/XXXX

# make

# make install

As above AAA operation;

7. Mod_python (mod_python-3.3.1)

Mod_python allows embedding Python within the Apache server for a considerable boost in performance and added flexibility in designing web based applications.

Trac provides three options for connecting to a “real” web server: CGI, FastCGI and mod_python. For decent performance, it is recommended that you use either FastCGI or mod_python.

# ./configure –prefix=/path/to/modpython –with-apxs=/path/to/httpd/bin/apxs \

–with-python=/path/to/python/bin/python2.x –with-mutex-dir=/var/run/mod_python \

–with-flex=/path/to/flex/bin/flex –with-max-locks=38

# make

# make install

The end, system will tell you:

” Now don’t forget to edit your main config and add

LoadModule python_module /path/to/httpd-2.0.61/modules/mod_python.so

and if your configuration uses ClearModuleList, then also

AddModule mod_python.c”

You must edit Apache configration file - httpd.conf, insert

LoadModule python_module modules/mod_python.so

and add following directive:

SetHandler mod_python

PythonHandler mod_python.testhandler

After the Apache run “restart” directive, we can get about Mod_python and Apache’s run status through HTTP protocol : http://localhost/mpinfo .

As above AAA operation;

8. Install clearsilver (clearsilver-0.10.5)

# ./configure –prefix=/path/to/clearsilver –disable-java –disable-ruby –disable-perl –disable-csharp \

–with-apache=/path/to/httpd –with-python=/path/to/python/bin/python

# make

# make install

As above AAA operation;

Hint The /path/to/python/lib/python2.x/site-packages directory has the “neo_cgi.so” module.

9. Build trac (trac-0.10.4)

# python ./setup.py build

# python ./setup.py install

will byte-compile the python source code and install it in the

site-packages directory of your python installation. The directories cgi-bin,

templates, htdocs and wiki-default are all copied to “/usr/share/trac/“.

if you special Python install path, then

# /path/to/python ./setup.py build

# /path/to/python ./setup.py install

The directories cgi-bin, htdocs and wiki-default are all copied to “/path/to/python/share/trac/“.

10. Creating Project Environment

# trac-admin /path/to/projectenv initenv

edit httpd.conf:

SetHandler mod_python

PythonInterpreter main_interpreter

PythonHandler trac.web.modpython_frontend

PythonOption TracEnvParentDir /path/to/repository_trac

PythonOption TracUriRoot /trac

AuthType Basic

AuthName “company Trac”

AuthUserFile /path/to/auth-file (htpasswd)

Require valid-user

11. TracWebAdmin

# sh setuptools-0.6c7-py2.5.egg

# unzip TracWebAdmin-0.1.2dev_r4240-py2.4.egg.zip

# wget http://svn.edgewall.com/repos/trac/sandbox/webadmin/setup.cfg

# wget http://svn.edgewall.com/repos/trac/sandbox/webadmin/setup.py

Please place “setup.cfg” and “setup.py” to TracWebAdmin-0.1.2dev_r4240-py2.4.egg’s unzip directory,

# python setup.py build

# python setup.py install

No comments: