apt-get install libapache2-svn libsvn-perl libsvn1 libldap-2.4-2 libldap2-dev trac libapache2-mod-python libapache2-mod-python-doc apache2-mpm-prefork
####trac default use sqlite database to deposit project database
####but you can use other database software “mysql,postgresql
root@wikiserver:/etc/apache2/mods-available# vi dav_svn.conf###没配置
root@wikiserver:/etc/apache2/mods-available# vi ../apache2.conf
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
ServerTokens Full
ServerSignature On
root@wikiserver:/etc/apache2/mods-available# vi ../httpd.conf
Redirect permanent /<project> http://<ip/hostname>/<project>
Redirect permanent /<project> http://<ip/hostname>/<project>
<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 [email protected]
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 [email protected]
AuthLDAPBindPassword "123456"
authzldapauthoritative Off
require valid-user CN=Users,dc=domainname,dc=com
</Location>
<Location /project>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /srv/trac/projects/project
PythonOption TracUriRoot /Sandbox
</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 [email protected]
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 [email protected]
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>
###enable python
a2enmod python
###enable ldap auth
a2enmod authnz_ldap
trac配置项目:
root@SHTRAC01:/srv/trac/projects# pwd
/srv/trac/projects
root@SHTRAC01:/srv/trac/projects# ls
projects projects projects
svn项目:
root@SHTRAC01:/srv/svn_repo# ls
AeSwExchg Samsung TD-Project
root@SHTRAC01:/srv/svn_repo# pwd
/srv/svn_repo
###############################################
###if you use other database software like mysql:
登陆MySQL
#mysql mysql -u root -p
创建用户trac
mysql>GRANT ALL PRIVILEGES ON *.* TO trac@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
mysql> flush privileges;
###############################################
创建trac项目环境:
root@SHTRAC01:~# trac-admin eee initenv
Creating a new Trac environment at /root/eee
Trac will first ask a few questions about your environment
in order to initialize and prepare the project database.
Please enter the name of your project.
This name will be used in page titles and descriptions.
Project Name [My Project]> eee
Please specify the connection string for the database to use.
By default, a local SQLite database is created in the environment
directory. It is also possible to use an already existing
PostgreSQL database (check the Trac documentation for the exact
connection string syntax).
Database connection string [sqlite:db/trac.db]>
###############################################
#Database connection string [sqlite:db/trac.db]>mysql://trac:password@localhost:1521/project //这里我们用MySQL数据库,如果用SQLite直接回车即可
###############################################
Please specify the type of version control system,
By default, it will be svn.
If you don't want to use Trac with version control integration,
choose the default here and don't specify a repository directory.
in the next question.
Repository type [svn]>
Please specify the absolute path to the version control
repository, or leave it blank to use Trac without a repository.
You can also set the repository location later.
Path to repository [/path/to/repos]> <svn project name path>
####start apache
/etc/init.d/apache2 start/restart/stop