Saturday, March 21, 2009

Trac on Windows - Installation and configuration

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.

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.

[Note :- Please do not consider this doc as a replacement to Trac support. This is what I found on internet and consolidated at one place.]

Please download all the software required. List is given below with the links to download.

Installation Files

  • Python 2.5
  • Trac
  • SVN Python
  • pysqlite
  • Genshi
  • TortoiseSVN
  • ez_setup.py

Installing the Software

1. Let’s assume you have a working repository which we will say is located at D:\repos and a folder with all of your code located at D:\code.

2. Firstly 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 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

2. Get your ez_setup.py file and move it into C:\Python25\Scripts folder. Start the 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. Now type the following command at the same prompt.

trac-admin d:\tracproject initenv

4. This will install Trac to the d:\tracproject directory. Please provide the following details to the command.

Project Name [My Project] - <as per requirement>

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] > D:\repos

5. To easily handle accounts in Trac install Account Manager Plugin available from Trac Hacks

Type the following and hit Enter ( cmd pointing to dir :- C:\Python25\Scripts). This command will install Account manager plugin for trac 11. If you are using trac other than this please refer to site.

easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk

6. There’s a file called trac.ini (d:\trackproject\config )- 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

7. In explorer go up a level to d:\tracproject and create a new text file called passwd.txt - leave the file blank.

8. 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

9. 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

10. Open up your favourite browser and paste this URL: http://localhost:8000/. You should see a link to the name you gave your project. Click on that and there you have Tracd - the front end of the Trac software.

11. 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 D:\tracproject\passwd.txt and the realm is “trac“.

12. 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.

13. 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 guide has helped you get Trac running on your systems. Please feel free to make comments/suggestions/improvement.

No comments:

Post a Comment

Followers

About Me

Pune, Maharashtra, India