= Trac on Ubuntu = These instructions were written for a '''fresh install''' of Ubuntu. This documentation suggests performing [http://www.ubuntulinux.org/support/documentation/faq/installation-custom/view?searchterm=server%20install custom install] when installing Ubuntu to create a base system without an X server or other graphical niceties. These instructions, however, should work reasonably well if you already have Ubuntu installed or you have performed a full install. '''Warty users:''' Ubuntu needs versions of {{{python-sqlite}}} and {{{clearsilver}}} that aren't available on Warty (see #468 & #1104). You will need to [http://ubuntuguide.org/4.10/index.html#upgradewartytohoary upgrade to the Hoary release] or later. '''Breezy and Dapper:''' should work fine with the following instructions. === Installation === === 1. Install Software Packages === To install Trac on your system, install the {{{trac}}} and {{{libapache2-svn}}} packages: {{{ sudo apt-get install trac libapache2-svn }}} === 2. Create the Trac Environments Directory === You'll need a directory for Trac's environments to live that should be writable by the default Apache user: {{{ sudo mkdir /var/trac sudo chown www-data:www-data /var/trac }}} If you put your environment somewhere else, make sure to note that and use that location in the appropriate places in the next step. === 3. Setup Apache2 === Next, create a new Apache-2 virtualhost by saving the following as {{{/etc/apache2/sites-available/trac}}} : {{{ ServerAdmin webmaster@localhost ServerName trac.example.com DocumentRoot /usr/share/trac/cgi-bin/ Options Indexes FollowSymLinks MultiViews ExecCGI AllowOverride All Order allow,deny allow from all Alias /trac "/usr/share/trac/htdocs" SetEnv TRAC_ENV "/var/trac" DirectoryIndex trac.cgi ErrorLog /var/log/apache2/error.trac.log CustomLog /var/log/apache2/access.trac.log combined }}} You also need to uncomment the {{{AddHandler}}} line in {{{/etc/apache2/apache2.conf}}} so that the Trac CGI program will be executed: {{{ # To use CGI scripts outside /cgi-bin/: # AddHandler cgi-script .cgi }}} Now, disable the default virtualhost, enable the Trac virtualhost, and restart Apache2: {{{ sudo a2ensite trac sudo a2dissite default sudo /etc/init.d/apache2 restart }}} This last step would differ if you were already serving other virtualhosts. If you are going to want to login, you're going to need authentication. I added the following to my virtual host file to get this to work: {{{ AuthType Basic AuthName "Trac" AuthUserFile /etc/apache2/dav_svn.passwd Require valid-user }}} This will share the password with your subversion install. You'll also need to grant each user rights using trac-admin. Alternately, you can use htpasswd to create an htpasswd file, and point AuthUserFile at that location. === 4. Creating Environments === I installed my Subversion repository at {{{/var/svn/YourProjectNameHere}}}. So I did a quick starting config of subversion with the following commands: {{{ sudo mkdir /var/svn sudo mkdir /var/svn/YourProjectNameHere sudo mkdir /tmp/YourProjectNameHere sudo mkdir /tmp/YourProjectNameHere/branches sudo mkdir /tmp/YourProjectNameHere/tags sudo mkdir /tmp/YourProjectNameHere/trunk sudo svnadmin create /var/svn/YourProjectNameHere sudo svn import /tmp/YourProjectNameHere file:///var/svn/YourProjectNameHere -m "initial import" sudo rm -rf /tmp/YourProjectNameHere }}} Some permissions changes and an apache restart are now needed: {{{ sudo chown -R www-data /var/svn/YourProjectNameHere sudo chown -R www-data /usr/share/trac sudo apache2 -k restart }}} Test by web-browsing to {{{http://servername/svn/YourProjectNameHere}}} If you see a simple web page which says '''Revision 1: /''' and lists ''branches'', ''tags'', and ''trunk'', your Subversion install is up and running! Now let's finish the Trac install (but don't go on to Trac install until you have the above working properly). I put my trac environment at {{{/var/trac/YourProjectNameHere}}}. Of course you could use any other path or name - something a little more descriptive of ''your'' project would probably be a good idea. First I ran these commands: {{{ sudo mkdir /var/trac sudo trac-admin /var/trac/YourProjectNameHere initenv sudo chown -R www-data /var/trac/YourProjectNameHere }}} The "trac-admin" command shown above prompted me to enter: * the project name ({{{YourProjectNameHere}}}) * the path to svn repository ({{{/var/svn/YourProjectNameHere}}}) * the path to the Trac templates directory ({{{/usr/share/trac/templates}}}) ... then it prints out a bunch of stuff. If there are no errors you should now be able to surf to your Trac site at '''!http://servername/trac.cgi''' At the time I did my install, there was one glitch in the Ubuntu Universe Trac installer. It doesn't install the neo_cgi.so file needed in the python2.4 directory space. So when I surfed to my Trac site, I got the error '''!ImportError: No module named neo_cgi'''. I was able to fix this by symlinking the python2.3 version like so: {{{ sudo ln -s /usr/lib/python2.3/site-packages/neo_cgi.so /usr/lib/python2.4/site-packages/neo_cgi.so }}} ''Voila! Your Trac system & website should be up and running.'' == Comments & Suggestions == * Celebrate with beer. === mod_python Install === The above instructions are for a CGI-based install. For a simple mod_python install, within your existing Virtual Host: {{{ apt-get install libapache2-mod-python }}} Follow steps 1 & 2 above. For step 3, here's simple config (this would go inside your existing Virtual Host definition). You also shouldn't have to do any of the other stuff in step 3. {{{ SetHandler mod_python PythonHandler trac.ModPythonHandler # For Breezy++ use: PythonHandler trac.web.modpython_frontend PythonOption TracEnv /var/trac PythonOption TracUriRoot "/trac" }}} For more complex mod_python configs, see TracModPython You will also need to modify the settings in {{{/etc/apache2/mods-available/dav_svn.conf}}} {{{ # Uncomment this to enable the repository, DAV svn # Set this to the path to your repository SVNParentPath /var/svn }}} Now, follow the Subversion setup instructions in Step 4 (just the Subversion setup - you don't have to do the rest). Next, {{{ sudo chown -R www-data /var/svn/YourProjectNameHere sudo /etc/init.d/apache2 restart }}} Then set up the Trac environment. {{{ sudo mkdir /var/trac sudo trac-admin /var/trac/YourProjectNameHere initenv sudo chown -R www-data /var/trac/YourProjectNameHere }}} Now, you should be able to access Trac at http://youserver.name/trac == Problems == Ubuntu universe and Hoary Backports only have Trac 0.8 available at this writing. The Edgewall 0.8.4 debian packages specifically require the python2.3-subversion package, which makes installing on Hoary quite painful, as only python2.4-subversion is available without going directly to old debian repos. :( Are '''2.3''' Python packages really strictly required? Current Ubuntu 0.8 package does seem to work fine without the neo_cgi problem mentioned above, however. '''Solution:''' {{{trac 0.8.4-1ubuntu1}}} is currently in Ubuntu Breezy. As the dependencies didn’t change and are coverable by the packages in Hoary, one can simply grab the package from [http://archive.ubuntu.com/ubuntu/pool/universe/t/trac/ the archive] and (provided all of the dependencies are fulfilled) simply {{{ sudo dpkg -i trac_0.8.4-1ubuntu1_all.deb }}} === SVN === I had to add a section to the virtual host to make the SVN repository work correctly: {{{ DAV svn SVNParentPath /var/svn }}}