Go Back to Main Page
How To: Install Subversion with Trac on Windows
Version 1.7
Created: 02-12-2007
Modified: 05-16-2007
============================================================
You will need the following files, download them before starting:
Subversion Files
svn-1.4.0-setup.exe
Home: http://subversion.tigris.org/
Download: http://subversion.tigris.org/files/documents/15/34093/svn-1.4.0-setup.exe
tortoiseSVN-1.40.7501-win32-svn-1.4.0.msi
Home: http://tortoisesvn.tigris.org/
Download:http://downloads.sourceforge.net/tortoisesvn/TortoiseSVN-1.4.0.7501-win32-svn-1.4.0.msi?modtime=1158418822&big_mirror=0
Apache Files
Use apache 2.0.59-win32-x86-no_ssl.msi
Home: http://www.apache.org/
Download: http://www.axint.net/apache/httpd/binaries/win32/apache_2.0.59-win32-x86-no_ssl.msi
Trac Files
Trac
Home: http://trac.edgewall.org/
Download: http://ftp.edgewall.com/pub/trac/trac-0.10.3.win32.exe
Clearsilver
Home: http://www.clearsilver.net/
Download:http://www.clearsilver.net/downloads/win32/clearsilver-0.9.14.win32-py2.3.exe
Python use version 2.3
Home: http://www.python.org/
Download: http://www.python.org/ftp/python/2.3.5/Python-2.3.5.exe
svn-python-1.4.0-py23.exe (note this svn must match your subversion version and python version)
Home: http://subversion.tigris.org/
Download: http://subversion.tigris.org/downloads/svn-python-1.4.0-py2.3.exe
pysqlite-1.1.8.win32-py2.3.exe (note this pysqlite connector needs to be the same version as the installed python)
Home: http://www.initd.org/tracker/pysqlite/wiki/pysqlite
Download: http://initd.org/pub/software/pysqlite/releases/1.1/1.1.8/pysqlite-1.1.8.win32-py2.3.exe
mod_python (if you don't want to use CGI)
Home: http://www.modpython.org/
Download: http://www.apache.org/dist/httpd/modpython/win/3.2.10/mod_python-3.2.10.win32-py2.3-apache2.0.exe
setuptools-0.6c5.win32-py2.3.exe (for the web admin)
Home: http://peak.telecommunity.com/DevCenter/setuptools
Download: http://cheeseshop.python.org/packages/2.3/s/setuptools/setuptools-0.6c5.win32-py2.3.exe#md5=c63116466c40fd38921c9e73a071461c
tracwebadmin-0.1.2dev_r4240-py2.3.egg.zip (for the web admin)
Home: http://trac.edgewall.org/wiki/WebAdmin
Download: http://trac.edgewall.org/attachment/wiki/WebAdmin/TracWebAdmin-0.1.2dev_r4240-py2.3.egg.zip?format=raw
I have only tested this guide with the above files. If you deviate and try to use different versions the end result will probably be different from mine. Because the bindings have to be the same versions I decided to stick with Python23. There seemed to be more support for Python23, and when I was doing the research for this a few months back, I could not find all the bindings I needed for Python 2.4.
This guide assumes that you install subversion and apache to their default locations on the c:\. It also assumes that the database for trac and subversion are placed in a folder called c:\tracsvn\svnrepos if you don't want to place the the database on c:\ or if you change the folder names make sure that you use your path and folder names in the commands!
The guide has two methods for the web server CGI and mod_python. I prefer to use mod_python as its faster.
What this guide does not cover:
Installing SSL
Integration with Active Directory
Install Steps:
Download the necessary files (see the list above, don't start until this is done)
1. Install and Configure Subversion.
a. Run the Subversion installer! Start svn-1.4.0-setup.exe installer. Follow the install wizard and enter the appropriate information.
b. After the installer is finished make sure you have the Environment Variables set for SVN_EDITOR:Create a new variable name called SVN_EDITOR set the path to c:\windows\notepad.exe
If you don't know how to setup an Environment Variable see below:
To create a new environment variable in windows click on start, then right click on my computer, then click on properties, next click on the advanced tab, and then click on Environment Variables. Click on new, for the variable name type SVN_EDITOR and for the variable value you would type c:\windows\notepad.exe
c. Create a repository you must specify fsfs as the db type.On the Drive that you want your repository to be located, make a new folder called "tracsvn" inside this folder make another folder called "svnrepos". (Be sure to create the folder names in lowercase. I have seen issues where the directory names were not typed in the correct case.) From a command line run the following command: (You may have to run the command from the c:\Program files\subversion\bin directory.)
svnadmin create --fs-type fsfs c:\tracsvn\svnrepos
d. Create a windows service for the repository, and start the service.From a command line run the following command.
sc create Subversion binpath= "\"c:\program files\subversion\bin\svnserve.exe\" --service --root e:\tracsvn\svnrepos" displayname= "Subversion Repository" depend= Tcpip
Notes: "Subversion" is the service name "Subversion Repository" is the display name --root tells where the root of the database is and depend makes the service depend on Tcpip.
If you need to delete the service type: sc delete Subversion Repository
Go to the new service and set its startup type to automatic. Start the service if its stopped.
e. Reboot the server. Don't Skip
f. Configure Access In the repository folder "c:\tracsvn\svnrepos\conf" find the file svnserve.conf, modify the file to look like this:
[general]
anon-access = read
auth-access = write
password-db = pass
authz-db = authz
realm = myprojectIn the same directory create a file called "pass" it should look like this: [users]
admin = password
bob = bobspasswordDon't forget to save the file.
In the same directory create a file called authz it should look like this: [/]
* =
admin = rw
bob = rNotes: This will give anonymous users no access, admin will get read and write and bob will get read only.
g. Create a new Subversion project in the tracsvn\svnrepos repository, and create the projects structure, by running the below from a command line. Give your project a name I used myproject you can use whatever you want svn mkdir svn://localhost/myproject
svn mkdir svn://localhost/myproject/branches
svn mkdir svn://localhost/myproject/tags
svn mkdir svn://localhost/myproject/trunkAfter you run each command notepad will automatically open. On the first line of the notepad file type a comment, then close notepad and save. This is your first commit.
Notes: branches would be the working copies of active work, tags would be the final versions of a branch, trunk is the current active work or work being coded.
h. Install Tortoise for each user that will have commit rights or rw access. Users that have r access will only be able read and cannot make commits.
This guide does not go into detail on how to use Tortoise see the Tortoise web site for help documentation.
2. Install and Configure Apache
a. Run the apache installer, apache 2.0.59-win32-x86-no_ssl.msi. Follow the install wizard and enter the appropriate information.
b. Copy the subversion modules and the dll's to the apache modules directory:In the subversion bin folder (this should be c:\program files\subversion\bin) copy mod_authz_svn.so and mod_dav_svn.so files and paste to the apache modules folder. (This should be c:\program files\Apache Group\Apache2\modules)In the subversion bin folder copy all the dll files and paste to the apache modules folder.
c. Create a password hash:Cut the pass and authz files that we created in c:\tracsvn\svnrepos\conf and paste them to "c:\tracsvn"From a command prompt in the c:\program files\apache group\apache2\bin folder type:
htpasswd -cm c:\tracsvn\pass.tmp admin
Open the new pass.tmp file which was saved to c:\tracsvn and copy the admin password out and paste it to the working pass file.
Your pass.tmp file should look something like this: admin:$agg$sa/.....$98eabcdUIPOKJHAZHADSKFA.
If you open pass.tmp in notepad you will see a block character after the period, only copy to the period you don't want the block
After you paste the admin password into your working pass file, the "c:\tracsvnpass" file should look like this: [users]
admin:$agg$sa/.....$98eabcdUIPOKJHAZHADSKFA.Notes: This will create an encrypted password and now your passwords are not in plain text.
Repeat the above steps for each user you want to add.
d. Configure the httpd.conf file.Locate the httpd.conf file in c:\program files\apache group\apache2\conf directory and uncomment the following
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.soAfter the above add # Subversion -- Modules start
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
# Subversion --End of modulesYou don't have to keep the # Subversion comments, however commenting helps one remember why changes were made.
Uncomment the following: (If you plan to use mod_python skip this step) AddHandler cgi-script .cgi
e. Install apache as a service - from the bin folder run: (You may not have to do this, check windows services before running the command. If apache is listed as a service skip this step.) Apache -k install -n "Apache2"
f. Add Subversion to apache in the httpd.conf (Skip this step if you plan on installing Trac.) At the very end of the httpd.conf file add the text below.
# Subversion -- Start needed for browsing subversion outside of trac
<Location /svn>
DAV svn
SVNPath c:/tracsvn/svnrepos
AuthType Basic
AuthName "Subversion repository"
AuthUserFile c:/tracsvn/pass
AuthzSVNAccessFile e:/tracsvn/authz
Require valid-user
</Location>
# Subversion -- ENDNotes: After you add the above, the pass and authz files that you setup in c:\tracsvn\svnrepos will not be read. This is why they were moved to "c:\tracsvn" folder
g. Delete the c:\tracsvn\svnrepos\conf\svnconf.conf file.
h. Restart the Apache Services.
3. Install and configure Python23 and Python Modules
a. Run the Python-2.3.5.exe file
b. Add Python to the PathAt the end of variable name "Path" add this:
C:\Python23
Notes: be sure to add a ";" before the c:python23
c. Add Python\Scripts to the PathAt the end of variable name "Path" add this:
C:\Python23\Scripts
d. Reboot the Server Don't Skip this Step
e. Install svn-pythonRun the svn-python-1.4.0-py2.3.exe file.
Notes: This is for subversion 1.40 and python 2.3 if you install subversion 1.42 you will have to download the correct svn and python versions. Remember the versions Must Match!!
f. Install pysqliteRun the pysqlite-1.1.8.win32-py2.3.exe installer using the defaults.
g. Install clearsilverRun clearsilver-0.9.14.win32-py2.3.exe installer using the defaults.
h. Install mod_python: (Only if you plan on using mod_python)Install mod_python-3.2.10.win32-py2.3-apache2.0.exe installer using the defaults.After the install is finished add the below to your httpd.conf file. I placed mine right below the mod_dav_fs.so module
LoadModule python_module modules/mod_python.so
4. Install and configure Trac
a. Run the trac-0.10.3.win32.exe installer
b. Copy the CGI script (If you plan to use mod_python skip this step)Locate the trac.cgi file (this will be in the python23\share\trac\cgi-bin folder)Using notepad make sure the first line reads
#!C:\Python23\python.exe
Copy trac.cgi to the c:\program files\apache group\apache2\cgi-bin folder
c. Configure the tracdbFrom Python23 directory type
python scripts/trac-admin c:/tracsvn/trac.db
d. From the trac prompt type: initenv
e. Enter the Project name MyTracSite
f. For the database connection string, press enter to accept sqlite.
g. On the Add Repository Prompt press enter to accept the default "svn"
h. Path to repository will be: c:\tracsvn\svnrepos
i. path to templates is c:\python23\share\trac\templates press enter to accept the default.
j. Add admin to TracWhile still in the trac config tool type:
permission add admin TRAC_ADMIN
k. Type "exit" to leave the trac-admin tool.
l. Configure TRAC with Apache - using CGI - (If you plan to use mod_python skip this step)Configure Apache... At the very end of the httpd.conf file add the following:
# TRAC -- START needed for browsing subversion inside of trac
<Location /cgi-bin/trac.cgi>
SetEnv TRAC_ENV "c:/tracsvn/trac.db"
SetEnv PYTHONPATH "c:/Program Files/Subversion/bin"
# if you are running Apache as a user other than System, the TMP variable
# needs to be set to a place where that user can write scratch files. Make
# sure that this directory is created and writable by that user.
#SetEnv TMP "c:/tracsvn/trac.db/TMP
</Location>
<Location /cgi-bin/trac.cgi/login>
AuthType Basic
AuthName "MyTracSite"
SVNPath c:/tracsvn/svnrepos
AuthUserFile c:/tracsvn/pass
AuthzSVNAccessFile c:/tracsvn/authz
Require valid-user
</Location>
<Directory "C:/Python23/share/trac/htdocs">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
#TRAC -- ENDBe sure to restart apache after any changes you make to the conf files.
m. Configure Apache for TRAC using - mod_python -Configure Apache... the last line of the httpd.conf should be "# Subversion -- END" below this add:"
# TRAC -- START needed for browsing subversion inside of trac
<Location /trac>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv "c:/tracsvn/trac.db"
</Location>
<Location "/trac/login">
AuthType Basic
AuthName "MyTracSite"
SVNPath c:/tracsvn/svnrepos
AuthUserFile c:/tracsvn/pass
AuthzSVNAccessFile c:/tracsvn/authz
Require valid-user
</Location>
<Directory "C:/Python23/share/trac/htdocs">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
#TRAC -- ENDNotes: if you have issues with mod_python you can add the below to the httpd.conf to test mod_python install
<Location /mpinfo>
SetHandler mod_python
PythonHandler mod_python.testhandler
</Location>The site would http://localhost/mpinfo
Be sure to restart apache after any changes you make to the conf files.
It would be a bad idea to keep the /mpinfo up on a production install be sure to comment out!
n. Install webadmin Run the setup tools installer. (This would be file - Setuptools-0.6c5.win-py2.3.exe)
Notes: to test the install of setup tools run the script below you should get a blank prompt after the command is run. run the command from "c:\python23\scripts"
python -c "import pkg_resources"
Copy the tracwebadmin-0.1.2dev_r4240-py2.3.egg.zip file to c:\pythyon23\scripts rename the file only taking the zip extension off the name.From the c:\python23\scripts folder open a command prompt and run the command below. easy_install TracWebAdmin-0.1.2dev_r4240-py2.3.egg
In the trac.ini file(this file is in c:\tracsvn\trac.db\conf add the below [components]
webadmin.* = enabledRestart the apache server
o. Configure the authz file in the trac.iniThe trac.ini file is in the c:\tracsvn\trac.db\conf folder. Modify the authz_file section to look like this:
authz_file = c:\tracsvn\authz
Restart the apache serverGoto the trac site and login using admin. You should see a new button called "admin" on the far right hand side of the main menu.
If you click on Admin and get settings then the install worked
5.Backup the database
Use the hotcopy command, while using a normal backup tool on an FSFS database is possible its not recommended see http://svn.collab.net/repos/svn/trunk/notes/fsfs for more information.
The following is a backup script batch file from: http://justinram.wordpress.com/2006/05/03/subversion-server-windows-backup/
a. Create a bat file with the following data: REM Reset HotCopy directory
rmdir /S Q c:\dbBack
mkdir c:\dbBack
REM Backup The Subversion db using hotcopy
svnadmin hotcopy c:/tracsvn/svnrepos c:\dbBack --clean-logsb. create a scheduled task pointing to the backup script. You could then use a backup tool like NT backup to backup the c:\dbBack directory!
Change log:
+++++++++++++++++++++++++++++++++
2-12-2007:
Created
2-19-2007:
Added the change log section
Added section 5. (Backing up the DB)
3-19-2007
Changed some minor layout issues in section 3.
Fixed some spelling errors.
Added The words How To and Windows: to the title of the article.
5-16-2007
Changed some of the notes before section 1.
Fixed some of the paths had e:\ and they should have been c:\
Credits
Some of the information in this guide comes from the sources below:
Joe White's Blog
http://excastle.com/blog/archive/2005/05/31/048.aspx
Trac's Install Document for Windows
http://trac.edgewall.org/wiki/TracOnWindows
fsfs information
http://svn.collab.net/repos/svn/trunk/notes/fsfs
Backup scripts
http://www.blendedtechnologies.com/daily-backupof-subversion/21
http://justinram.wordpress.com/2006/05/03/subversion-server-windows-backup/
svn.haxx.se
http://svn.haxx.se/users/archive-2006-06/0288.shtml