Edgewall Software

Changes between Initial Version and Version 1 of TracUbuntuMultipleProjects


Ignore:
Timestamp:
Sep 30, 2006, 10:35:47 AM (18 years ago)
Author:
anonymous
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • TracUbuntuMultipleProjects

    v1 v1  
     1= Installing Trac on Ubuntu for Multiple Projects using Mod_Python =
     2
     3this page is geared towards an installation of trac that will run off the apache webserver using mod_python, and support multiple projects. the distro is ubuntu. i'm totally new to Trac, so feel free to correct any errors.
     4
     5the install page on the trac site (see TracInstall) is confusing. it doesnt explain well how trac relates to the server. it gives manual install information, but on ubuntu, which we use, you use apt-get instead. the next thing it recommends is to set up a project environment, but you probably dont actually want to this yet since you want to set up the interaction of trac with the server first. this is done largely by following instructions on the TracModPython page.
     6
     7there is another site for setting up Trac on Ubuntu, TracOnUbuntu, but the focus there is on the CGI method, plus for whatever reason, i found the instructions a little inapplicable for my system. for example, i had no dav_svn module in my /etc/apache2/mods-available directory, and that sent me on a wild goose chase for quite a while, only to realize i didnt need it (at least, so far!)
     8
     9note: apt-get install puts trac's main files in the directory: /usr/share/trac
     10
     110. install
     12
     13{{{
     14      % apt-get install trac
     15}}}
     16
     17install all necessary dependencies as well.
     18
     19it's worth opening the TracModPython page to follow along side these instructions.
     20
     211. you do NOT need to add the line:
     22{{{ LoadModule python_module modules/mod_python.so}}}
     23to your apache2.conf file.
     24
     252. you should create a directory where all your Trac projects will live. issue (from TracOnUbuntu):
     26
     27{{{
     28    %sudo mkdir /var/trac
     29    %sudo chown www-data:www-data /var/trac
     30}}}
     31
     32
     333. now add the following to the {{{<VirtualHost>}}} directive of whatever site you want to use Trac on:
     34
     35{{{
     36<Location /projects> #set up Trac handling     
     37     SetHandler mod_python   
     38     PythonHandler trac.web.modpython_frontend   
     39     PythonOption TracEnvParentDir /var/trac   
     40     PythonOption TracUriRoot /projects   
     41  </Location>     
     42}}}
     43
     44(this is the instructions given for if you want to host multiple projects one one site; it doesnt say one way or another if you could do this with multiple virtual hosts on the same server, but i dont see why not).
     45
     46you can change {{{/projects}}} to be anything you want, as long as you are consistent throughout the other things you do which depend on what you call this location.
     47
     484. you need to do some pre-configuration to set up an actual subversion project BEFORE the
     49{{{
     50%trac-admin <projectpath/project> initenv
     51}}}
     52command will work.
     53
     54assuming for now you just want to create an empty base project in subversion without any actual code, do the following:
     55
     56create a 'home' subversion repository at /var/svn (this isnt necessary, just useful), and create a skeleton config for a project like so (cf: TracOnUbuntu):
     57
     58{{{
     59% sudo mkdir /var/svn
     60% sudo mkdir /var/svn/YourProjectNameHere
     61% sudo mkdir /tmp/YourProjectNameHere
     62% sudo mkdir /tmp/YourProjectNameHere/branches
     63% sudo mkdir /tmp/YourProjectNameHere/tags
     64% sudo mkdir /tmp/YourProjectNameHere/trunk
     65% sudo svnadmin create /var/svn/YourProjectNameHere
     66% sudo svn import /tmp/YourProjectNameHere file:///var/svn/YourProjectNameHere -m "initial import"
     67% sudo rm -rf /tmp/YourProjectNameHere
     68}}}
     69
     70the tmp files are necessary so that the svn import command has something to import (even if it's empty). if you dont do all this the initenv command will fail, complaining that whatever SVN directory you give it "isnt an SVN directory".
     71
     72then issue:
     73
     74{{{
     75% sudo chown -R www-data /var/svn/YourProjectNameHere
     76% sudo chown -R www-data /usr/share/trac
     77% sudo apache2 -k restart
     78}}}
     79
     805. try creating a project now (as root/admin):
     81
     82{{{
     83% trac-admin /var/trac/test_project initenv
     84}}}
     85
     86when done, you need to change the ownership of /var/trac/test_project to
     87
     88{{{
     89% chown -R www-data:www-data /var/trac/sitedev/
     90}}}
     91
     92where <user> is whoever is creating the project.
     93note: the -R is important, as www-data needs to access the database files while sit a couple of directories down from the top project directory.
     94
     95[[[[ btw, i spent a LONG time trying to figure out why i was missing the dav_svn module (mod_dav_svn.so wasnt in /usr/lib/apache2/modules/), since the instructions on the "Trac on Ubuntu" site implied i needed it, but then i decided to just see what happened if i created a project environment and it succeeded. so... go figure. ]]]]]
     96
     97if everything has gone right, your site will be working now! go to http://www.yoursite.com/projects, and you should see a listing of your one lone project. click on it and arrive at your project's main page.
     98
     99
     1006. authentication:
     101you dont NEED authentication, but it's a good idea. again, i found the main documentation lacked a couple of important details.
     102
     103setting up the accounts is pretty much by the book:
     104
     105{{{
     106% htpasswd -c /web/yoursite.org/.htpasswd admin
     107enter new password:
     108}}}
     109
     110for additional users (ie when you are not creating file for first time):
     111{{{
     112% htpasswd /web/yoursite.org/.trac.htpasswd <someotheruser>
     113enter new password:
     114}}}
     115
     116meanwhile, in the apache config file, you need to have a Directory directive that specifies:
     117
     118{{{
     119<Directory /absolute/path/yoursite.org/>
     120      AllowOverride AuthConfig
     121</Directory>
     122}}}
     123
     124and then within the {{{<VirtualHost>}}}, you require:
     125
     126{{{
     127<VirtualHost ... >
     128
     129...other site directives...
     130
     131    <Location /projects> #set up Trac handling
     132
     133      ... other Trac directives from above...
     134
     135     #authentication scheme
     136       AuthType Basic
     137       AuthName "Trac Projects"
     138       AuthUserFile /path/.htpasswd
     139       Require valid-user
     140   </Location>
     141</VirtualHost>
     142}}}
     143
     144this accomplishes password protection for the entire projects location (access to the entire trac system and all it's projects).
     145
     146
     147***************example**********
     148complete directives section in your apache config file (ie apache2.conf, httpd.conf, etc.) for yoursite.org:
     149
     150{{{
     151<VirtualHost aaa.bbb.ccc.ddd>
     152
     153ServerName www.yoursite.org
     154ServerAdmin your@email.com
     155DocumentRoot /web/yoursite.org/www
     156etc...
     157
     158  <Location /projects> #set up Trac handling
     159
     160     SetHandler mod_python
     161     PythonHandler trac.web.modpython_frontend
     162     PythonOption TracEnvParentDir /var/trac
     163     PythonOption TracUriRoot /projects
     164
     165   #authentication scheme
     166     AuthType Basic
     167     AuthName "Descriptive Title Here"
     168     AuthUserFile /web/yoursite.org/.htpasswd
     169     Require valid-user
     170
     171</Location>
     172</VirtualHost>
     173
     174<Directory /web/yoursite.org/>
     175      AllowOverride AuthConfig
     176</Directory>
     177}}}