ubunut 11.04-desktop-i386

apt-get install apache2 libapache2-svn libsvn-perl libsvn1 libldap-2.4-2 libldap2-dev  libapache2-mod-python libapache2-mod-python-doc apache2-mpm-worker trac mysql-server python-mysqldb  python-dev

vi /etc/apache2/apache2.conf
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
##    Satisfy All
</FilesMatch>

ServerTokens Full
ServerSignature On

vi /etc/apache2/httpd.conf
<Location /Projects>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /srv/trac/Projects
PythonOption TracUriRoot /Projects
</Location>

<LocationMatch "/Projects/[^/]+/login">
AuthType Basic
AuthName "Projects"
AuthBasicProvider "ldap"
AuthLDAPURL "ldap://scidc02.domainname.com:3268/Dc=domainname,dc=com?sAMAccountName?sub?(objectClass=user)"
AuthLDAPBindDN trac@domainname.com
AuthLDAPBindPassword "123456"
authzldapauthoritative Off
require valid-user CN=Users,dc=domainname,dc=com
</LocationMatch>

<Location /project>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /srv/trac/Projects/project
PythonOption TracUriRoot /project
</Location>

<Location /project/login>
AuthType Basic
AuthName "project"
AuthBasicProvider "ldap"
AuthLDAPURL "ldap://scidc02.domainname.com:3268/Dc=domainname,dc=com?sAMAccountName?sub?(objectClass=user)"
AuthLDAPBindDN trac@domainname.com
AuthLDAPBindPassword "123456"
authzldapauthoritative Off
require valid-user CN=Users,dc=domainname,dc=com
</Location>

<Location /svn>
DAV svn
SVNParentPath /srv/svn_repo
Authtype Basic
AuthName "Subversion repository"
AuthBasicProvider "ldap"
AuthLDAPURL "ldap://scidc02.domainname.com:3268/Dc=domainname,dc=com?sAMAccountName?sub?(objectClass=user)"
AuthLDAPBindDN trac@domainname.com
AuthLDAPBindPassword "123456"
AuthzLDAPAuthoritative Off
require valid-user CN=Users,dc=domainname,dc=com
</Location>

<Location /mpinfo>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler mod_python.testhandler
</Location>

sed -i "s#domainname#domainname#g" /etc/apache2/httpd.conf
sed -i "s#123456#12abAB#g" /etc/apache2/httpd.conf
sed -i "s#project#test#g" /etc/apache2/httpd.conf




mysql -u root -p
show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
+--------------------+


###CREATE DATABASE trac DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
CREATE DATABASE trac;
grant all on trac.* to trac@localhost identified by '123456';
flush privileges;

mkdir /srv/trac/Projects/test -p
mkdir /srv/svn_repo/test -p

trac-admin /srv/trac/Projects/test initenv
Project Name [My Project]> test
Database connection string [sqlite:db/trac.db]> mysql://trac:123456@localhost/trac
Repository type [svn]> svn
Path to repository [/path/to/repos]> /srv/svn_repo/test

svnadmin create /srv/svn_repo/test //创建svn数据仓库
svnserve -d  //start svnserver
chown www-data. /srv/* -R
a2enmod python
a2enmod authnz_ldap
/etc/init.d/apache2 restart

##从0.11.x 升级到 0.12.x
##将trac的版本升级以后,重新创建项目也可以

#Update the Trac Code
easy_install --upgrade Trac==0.12.x
easy_install-2.7 --upgrade Trac==0.12.x


#Upgrade the Trac Environment
trac-admin /path/to/projenv upgrade

#Update the Trac Documentation
trac-admin /path/to/projenv wiki upgrade