Trac and SVN install / configuration notes...

The below notes is specifically for centos-4.6 :

Installation:

# rpm -ivh  http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.i386.rpm
# yum install httpd subversion mod_python mod_dav_svn
# yum --enablerepo=rpmforge install trac

Instantiating svn:

# mkdir /var/www/svn
# svnadmin create /var/www/svn/project

Initial svn import:

# mkdir -p /tmp/newsvn/{trunk,tags,branches}
# svn import /tmp/newsvn file:///var/www/svn/project -m "Initial import"
# chown -R apache /var/www/svn/project
# chmod -R go-rwx /var/www/svn/project

Instantiating trac:

# mkdir /var/www/trac
# trac-admin /var/www/trac/project initenv
# mkdir /var/www/{.python-eggs,passwd}
# htpasswd -c /var/www/passwd/.htpasswd <adminuser>
# touch /var/www/passwd/svnauthz
# chgrp -R apache /var/www/trac/project
# chown -R apache /var/www/trac/project/{attachments,db,log,plugins}
# chown -R apache /var/www/{.python-eggs,passwd}
# chmod -R o-rwx /var/www/{trac/project,.python-eggs,passwd}
# chmod g+w /var/www/trac/project/conf/trac.ini

Install trac plugins:

# wget http://peak.telecommunity.com/dist/ez_setup.py
# python ez_setup.py
# easy_install http://svn.edgewall.com/repos/trac/sandbox/webadmin/
# easy_install http://trac-hacks.org/svn/accountmanagerplugin/0.10
# easy_install http://trac-hacks.org/svn/svnauthzadminplugin/0.10

trac.ini conf setup:

[trac]
default_charset=UTF-8
authz_file = /var/www/passwd/svnauthz

[components]
acct_mgr.admin.accountmanageradminpage = enabled
acct_mgr.api.accountmanager = enabled
acct_mgr.htfile.htpasswdstore = enabled
acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.loginmodule = enabled
trac.web.auth.loginmodule = disabled
webadmin.* = enabled
svnauthz.* = enabled

[account-manager]
password_file = /var/www/passwd/.htpasswd
password_store = HtPasswdStore

Apache trac conf setup:

Alias /trac /var/www/trac
<Location /trac>
    &nbsp;   SetHandler mod_python
    &nbsp;   PythonInterpreter main_interpreter
    &nbsp;   PythonHandler trac.web.modpython_frontend />    &nbsp;   PythonOption TracEnvParentDir /var/www/trac
    &nbsp;   PythonOption TracUriRoot /trac
    &nbsp;   SetEnv PYTHON_EGG_CACHE /var/www/.python-eggs
</Location>
#<Location /trac/*/login>
#    &nbsp;   AuthType Basic
#    &nbsp;   AuthName 'Trac Server'
#    &nbsp;   AuthUserFile /var/www/passwd/.htpasswd
#    &nbsp;   Require valid-user
#</Location>

Apache subversion conf setup:

<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn

   # Limit write permission to list of valid users.
   # <LimitExcept GET PROPFIND OPTIONS REPORT>
    &nbsp; # Require SSL connection for password protection.
    &nbsp; # SSLRequireSSL

    &nbsp; AuthType Basic
    &nbsp; AuthName 'Authorization Realm'
    &nbsp; # Trac .htpasswd file used so users will be the same for both
    &nbsp; AuthUserFile /var/www/passwd/.htpasswd
    &nbsp; Require valid-user
    &nbsp; AuthzSVNAccessFile /var/www/passwd/svnauthz
   #</LimitExcept>
</Location>

Trac privileges:

# trac-admin /var/www/trac/project permission add admins TRAC_ADMIN
# trac-admin /var/www/trac/project permission add <adminuser> admins
# trac-admin /var/www/trac/projectname permission remove anonymous TICKET_CREATE TICKET_MODIFY etc...
# track-admin /var/www/trac/project permission add devs BROWSER_VIEW CHANGESET_VIEW FILE_VIEW LOG_VIEW   &nbsp;    \
    &nbsp;    &nbsp;    MILESTONE_CREATE MILESTONE_VIEW REPORT_CREATE REPORT_MODIFY REPORT_SQL_VIEW REPORT_VIEW  \  
    &nbsp;    &nbsp;    ROADMAP_VIEW SEARCH_VIEW TICKET_APPEND TICKET_CHGPROP TICKET_CREATE TICKET_MODIFY \
    &nbsp;    &nbsp;    TICKET_VIEW TIMELINE_VIEW WIKI_CREATE WIKI_MODIFY WIKI_VIEW

Login as the admin user and setup Trac plugins, permissions etc...

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
A problem

Hi, Thank you for this very good tutorial. I have setup svn with its help but I am getting error when I am starting httpd service. It is in "Apache subversion conf setup:" Unknown DAV provider: svn
Please let me know what I forget to install.

Thanks

dav svn module

Check that the dav svn module is loaded in apache conf via:

LoadModule dav_svn_module  &nbsp;  modules/mod_dav_svn.so

It should have it if you have installed "mod_dav_svn" as mentioned above.

fsfs repository type

In Subversion 1.1, a Berkeley DB repository is the default repository type, but an FSFS repository can be created using the --fs-type option:

$ svnadmin create /path/to/repos --fs-type fsfs

From the propaganda notes at: svn.collab.net, it seems that "fsfs" is a better option to BDB for the filesystem implementation to be used when creating new repositories.

Upgrade to trac-0.11
  • Upgrade
    rpm -e trac
    easy_install --always-unzip Genshi
    easy_install Trac
    easy_install --upgrade http://trac-hacks.org/svn/accountmanagerplugin/trunk
    easy_install --upgrade https://svn.geophysik.uni-muenchen.de/svn/tracmods/tracsvnauthzplugin/0.11
  • Remove updated packages
    rm -rf /usr/lib/python2.4/site-packages/TracWebAdmin-0.1.2dev_r5911-py2.4.egg/
    rm -rf /usr/lib/python2.4/site-packages/TracAccountManager-0.1.3dev_r2548-py2.4.egg
    rm -rf /usr/lib/python2.4/site-packages/TracSVNAuthz-0.3-py2.4.egg
  • Update Environment:
    trac-admin $PATH_TO/project upgrade
    trac-admin $PATH_TO/project wiki upgrade
svn command reference
  1. Checkout:
    svn --username={user} co http://localhost/svn/project [project_folder]
  2. Add:
    cd {project_folder}
    svn st | awk '/^?/ {print $2}' | xargs svn add
  3. Remove:
    svn st | awk '/^!/ {print $2}' | xargs svn delete
  4. Remove all files except the .svn directory (to use with rsync):
    find * -path *.svn -prune -o -print0 | xargs -O rm -rf

    or

    find * -path *.svn -prune -o -print --exec rm -rf {} \;

  5. Exclude/ignore directory
    svn delete tmp/*
    svn propset svn:ignore ‘*’ tmp/
Comment