How To Install Trac on Windows
Trac is front end to subversion with integrated wiki for developers. Use this How To article to help you install Trac on a Windows computer that isn’t running Apache. The guide assumes you have a working Subversion repository and are using the TortoiseSVN shell on client PC’s.
Introduction
Firstly let me say Trac is a brilliant bit of software. It is basically a friendly front end to subversion which is a version control system. Trac allows you to use its in-built tracd software so you can view Subversion changes through a browser. Working with developers, this lets you track changes to code easily as well as support development goals through Trac’s project management tools.
This How To guide is by no means a replacement for the Trac documentation. The Trac site and the support provided by their developers is really very good. However I ran into a number of problems when installing the software on a standalone Windows server that wasn’t running Apache.
Installation Files
Installing the Software
1. OK so let’s assume you have a working repository which we will say is located at E:\repos and a folder with all of your code located at E:\code.
2. Let’s install Python – Double click the python-2.5.2.msi file and select ‘Install for all users’. Click Next and then Next again (change the location of the Python install if you wish). Click Next once more and Python will start installing. Click Finish and that’s Python installed.
3. Now let’s install the Python SVN file (”svn-python” etc) – Double click the file and then click Next, Next again and Next once more. The installation will run and click the Finish button when prompted.
4. Then we install Python SQLite – Double click the file and then click Next, Next again and Next once more. The installation will run and click the Finish button when prompted.
5. Trac needs to be installed now – Double click the Trac exe and then click Next, Next again and Next once more. The installation will run and click the Finish button when prompted.
6. Lastly we need to install Genshi – Double click the Genshi file and then click Next, Next again and Next once more. The installation will run and click the Finish button when prompted.
Getting Trac Running
1. Create a folder called tracproject or something similar – I’d recommend putting it in the same directory as your repository.
2. Get your ez_setup.py file and move it into C:\Python25\Scripts folder(or wherever your Python install is located). Bring up a command prompt (Click on Start > Run and type ‘cmd‘). Enter the following making sure you hit Enter after each of the four lines.
| cd c:\ cd pyth* cd scr* ez_setup.py |
3. This will bring up about 10 lines of code and then leave the command prompt in the same directory. Now type the following and hit Enter.
| trac-admin E:\project initenv |
This will install Trac to the E:\project directory. Now the CMD window will prompt you to input four pieces of information. Look at what I used below to indicate what you should use.
| Project Name [My Project] – I used “mycode” Database connection string [sqlite:db/trac.db]> Leave blank by hitting Enter Repository type [svn]> Leave blank by htting Enter Path to Repository [/path/to/repos]> E:\repos |
The CMD window will install Trac based on the existing repository. The more existing revisions you have in the repository the longer this process will take, it’s indexing each change you’ve ever made. Once the install is complete the last line should say “Congratulations!” but don’t close the cmd window!. So Trac is now installed but you’re not done yet. It must be configured correctly to get the most out of it’s use.
4. To easily handle accounts in Trac I would 100% recommend installing the Account Manager Plugin available from Trac Hacks (a handy site with lots of Trac plugins) – let’s do this now. In the same cmd window (which should still be in C:\Python25\Scripts) type the following and hit Enter.
| easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk |
This will bring up about 12 lines of code with the last line starting “Finished processing dependencies”.
5. In Windows open up the E:\project folder and go into the conf sub-directory. There’s a file called trac.ini - open it in an editor like Notepad. You need to copy the following lines below and paste them into Notepad above the [header_logo] section.
| [components] acct_mgr.admin.accountmanageradminpage = enabled acct_mgr.api.accountmanager = enabled acct_mgr.db.sessionstore = enabled acct_mgr.htfile.htdigeststore = enabled acct_mgr.pwhash.htdigesthashmethod = enabled acct_mgr.web_ui.accountmodule = enabled acct_mgr.web_ui.loginmodule = enabled acct_mgr.web_ui.registrationmodule = enabled trac.web.auth.loginmodule = disabled |
Once that’s been pasted in save the ini file and close Notepad. In explorer go up a level to E:\project and create a new text file called passwd.txt – leave the file blank.
6. Lastly let’s give all anonymous users (those who aren’t logged in) admin access. In the same CMD window type the following and hit Enter.
| trac-admin E:\project permission add anonymous TRAC_ADMIN |
Note this will not return any lines. We will remove the admin access later once you, the real admin, have created your account. And with that we can start Tracd. In CMD type the following and hit Enter.
| tracd –p 8000 E:\project |
7. Open up your favourite browser and paste this URL: http://localhost:8000/. You should see a link to the name you gave your project, such as mycode. Click on that and there you have Tracd – the front end of the Trac software.
8.In the top right there’s a tab called Admin – click on it. On the menu on the right click on Configuration and when the page loads select HtDigestStore where the filename is E:\project\passwd.txt and the realm is “trac“.
9. Below Configuration is Users – click on it. Create yourself an admin account. Now using the menu go to Permissions. On the right of that page you will see the Grant Permission section. Use the subject field for the username you gave yourself on the Users page and select the TRAC_ADMIN as Action. Click Add and you will see your username in the middle column of the page with TRAC_ADMIN next to it. For the subject anonymous click on the TRAC_ADMIN so it’s ticked and then click on the Remove selected items button.
10. From now on you will need to use that Admin account to Login and make changes to the Trac environment. By default anonymous users can still view all of the Tracd menu’s to see changes to the repository and view tickets.
I hope this How To guide has helped you get Trac running on your systems. Please feel free to make comments/suggestions/improvement.
Add to Favourites
You have done an excellent job, but the last line goes replaced with: tracd.exe –p 8000 E:\project, otherwise the script should be in error.
More thanks and congratulations.
best regards
Graziano (Italy)
ciao Graziano,
I think you can use tracd, tracd.exe and tracd.py and all of them will work. I always used ‘tracd’ and it always works.
Thanks for the comment and happy to help!
Excellent guide. Followed it to a T and am up and running smoothly. Thanks!
Glad to be of help Trent.
Very nice. Thanks.
In step 6 you gave TRAC_ADMIN to anonymous users. I guess you should undo that with
trac-admin E:\project permission remove anonymous TRAC_ADMIN
Also check visualsvn. After install, can integrate trac on that easy.
I’ve followed the instructions to a ‘T’, but in step 8 there is no “Configuration Menu” on the right after I click on Admin. I can’t seem to find anything similar that will let me establish the link to the password file. I’ve used all the links in the downloads section, so I know its not a version change. Do you have any idea what would cause this?
Nevermind, I reinstalled the Account Manager and the configuration options show up now. I’m not sure why it didn’t before. Awesome guide, btw. I’m setting up a SVN+Trac demo and this was the only place I’ve seen with a complete guide with current install links that work.
Logan, glad you got your Trac server running. When you’ve reached 40,000 revisions it really does come into its own. And I wrote this guide purely because as you said there isn’t a good enough guide anywhere else. Enjoy.
HI
I got this ERROR
E:\Python25\Scripts>ez_setup.py
File “E:\Python25\Scripts\ez_setup.py”, line 98
except pkg_resources.VersionConflict e:
^
SyntaxError: invalid syntax
Please help me out
Regards,
Kumar
Hi,
It was my mistake it works well. Great job.
Thanks,
Kumar
Wow, that was considerably more effort than I’m used to…and if it wasn’t for your great guide, I wouldn’t have succeeded – thanks!
Great tutorial! I was having some issues installing trac and getting it working but with this it was a breeze. Nice work. Thanks!
Nice work – I put trac up the old fashioned 20 go arounds , de-install compare versions debug reinstall way then discovered this site which could have saved me days.
I’ll put it in my doco and delicious and hope others are relieved the pain.
at first thanks for you post it very helpfull
but i have a problem: i got this error when try :
C:\Python25\Scripts>tracd -p 5000 D:\kunkun
Traceback (most recent call last):
File “C:\Python25\Scripts\tracd-script.py”, line 8, in
load_entry_point(’Trac==0.11.4′, ‘console_scripts’, ‘tracd’)()
File “C:\Python25\Lib\site-packages\trac\web\standalone.py”, line 270, in main
serve()
File “C:\Python25\Lib\site-packages\trac\web\standalone.py”, line 240, in serv
e
options.env_parent_dir, args)
File “C:\Python25\Lib\site-packages\trac\web\standalone.py”, line 107, in __in
it__
request_handler=TracHTTPRequestHandler)
File “C:\Python25\Lib\site-packages\trac\web\wsgi.py”, line 207, in __init__
HTTPServer.__init__(self, server_address, request_handler)
File “C:\Python25\lib\SocketServer.py”, line 330, in __init__
self.server_bind()
File “C:\Python25\lib\BaseHTTPServer.py”, line 101, in server_bind
SocketServer.TCPServer.server_bind(self)
File “C:\Python25\lib\SocketServer.py”, line 341, in server_bind
self.socket.bind(self.server_address)
File “”, line 1, in bind
socket.error: (10013, ‘Permission denied’)
somebody help me get through of it please.
anyway thanks !
Regards
Viet
EXCELLENT JOB. Would love some instruction on setting it to run using standalone webserver… just can’t seem to figure out what should be the root directory, since my E:\project\htdocs folder is EMPTY!
Hi! Really great job! It works. Now I am wondering if it has disadvantages running it without apache and how I can add more projects… Still working on it. But thanks a lot.
I get the message that Trac cannot sync with the file location because it is not a svn repository. I have VisualSVN intalled on Windows. Also when I go to do the initenv command the target directory has to be empty. I don’t get it.
Otherwise everything elso in the tutorial seemed to work.
Cindy
Hi, great guide. I have one problem though. When running trac-admin D:\tracproject\ initenv
I get a warning saying couldn’t index the repository.
And when I acces trac project I get the following
Warning: Can’t synchronize with the repository (Couldn’t open Subversion repository D:/MaxReposTest/Dir1: SubversionException: (”Expected FS format between ‘1′ and ‘3′; found format ‘4′”, 160043)). Look in the Trac log for more information.
I have Subversion 1.6 and Tortoise 1.6.2 installed before I started the trac 11.4 install. Is there an incompatibilty between trac 11.4 and Subversion 1.6?
trac.log doesn’t exist
trac runs and I can raise tickets but ever page displays the “Expected FS…..” error
Any info you have would be gratefully received
looks like the solution to this one is to use SVN Python 1.6.1
(svn-python-1.6.1.win32-py2.5.exe)
Thanks very much for a really useful guide.
Hi friends
I cant install the account manager plugin. Strp4. How to solve this
Thanks in advance
i’m stuck at the trac-admin E:\project
it prompt me that Import export: No module named pkg_resources
I get a “access is denied” error when executing the accountmanagerplugin at cmd prompt
I installed the service using instsrv utility. starting tht tracd service gives this error “windows could not tracd service on local computer”
AppParameters:c:\Python26\Scripts\tracd-script.py –port 8000 c:\TracApplication
Application: c:\python26\python.exe
this is on windows server 2008
pls help
Hi there,
The work with Windows 2008 Server is special because there is no Resource Kit available. Therefor the How-To on http://localhost:8000/trac/wiki/TracSystem#InstallingasaWindowsService is be helpful but first you have to download the Resource Kit for Windows 2003 Server…
Good Luck and Peace
Ice
The link to find “pysqlite” is obsolete.
I have found the following link which works:
http://code.google.com/p/pysqlite/downloads/list
Very nice website! I got it up and running on the first try.
Thanks a lot,, its very useful installation guide.
i have a question !
After installing this am getting the same options for all there is no diffrents between user and admin. — what and where went wrong in the above installation! ( i Followed Very strictly )
Second Question is : Once i shutdown and restart my stand alone, system, the page is not running http://localhost:8000/project
– i think its because of the service start is in it,,
!! could u tell me from where and how to start the service for this Trac .
Thanks in advance.
I tried to install the user-management-script using “easy_install”. It didn’t worked because the “svn”-command was unknown. Seems like TortoiseSVN does not provide the svn-command for the windows shell.
I solved the problem by installing sliksvn (http://www.sliksvn.com/en/download).
Got it working. I installed svn-python-1.6.6.win32-py2.5.exe.
The SVN-PYTHON linked above is 1.5.
So you have to use SVN 1.5.
SVN 1.6 will not work.