Edgewall Software

Version 2 (modified by bryan@…, 19 years ago) ( diff )

small edits

These instructions were written for a fresh install of Ubuntu(Hoary). Should work OK under other conditions too.

FYI, Trac has trouble with Ubuntu's WartyWarthog release; it needs versions of python-SQLite and clearsilver that aren't available on Warty (see #468 & #1104). So I upgraded my fresh Warty to the HoaryHedgehog release. A fresh Hoary install should be ok but I didn't test that.

To upgrade I changed my etc\apt\sources.list to look like this:

## Main & restricted
deb http://archive.ubuntu.com/ubuntu hoary main restricted
deb-src http://archive.ubuntu.com/ubuntu hoary main restricted

## Universe (needed for the Trac install)
deb http://archive.ubuntu.com/ubuntu hoary universe
deb-src http://archive.ubuntu.com/ubuntu hoary universe

## Security
deb http://security.ubuntu.com/ubuntu hoary-security main restricted
deb-src http://security.ubuntu.com/ubuntu hoary-security main restricted

… then ran the following commands to actually perform the update:

sudo apt-get update 
sudo apt-get -y upgrade

You can take a nice long break while Hoary is downloaded and installed.

Once that's done, we have a brand-new Hoary install. The rest of these instructions look painful, but really the hardest part is now over. With a fast net connection, you can do the rest of this in about ten minutes.

We need to install a few more things:

sudo apt-get install openssh-server
sudo apt-get install trac
sudo apt-get install libapache2-svn

Configure Apache for DAV (svn needs it) by editing /etc/apache2/sites-available/default. When you're done the file will look like this (I think my changes are pretty obvious - they are preceded by the comment lines IN ALL CAPS):

NameVirtualHost *
<VirtualHost *>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                # Commented out for Ubuntu
                #RedirectMatch ^/$ /apache2-default/
        </Directory>

## ---THESE LINES FROM ORIGINAL FILE WERE COMMENTED OUT---
#       ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
#       <Directory "/usr/lib/cgi-bin">
#               AllowOverride None
#               Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
#               Order allow,deny
#               Allow from all
#       </Directory>
## ---END OF COMMENTS---

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined
        ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

## ---THESE LINES WERE ADDED TO THE ORIGINAL FILE---
Alias /trac "/usr/share/trac/htdocs"
ScriptAlias /cgi-bin/ /usr/share/trac/cgi-bin/
<Location "/cgi-bin/trac.cgi">
 SetEnv TRAC_ENV "/var/trac/project"
</Location>

<Directory "/usr/share/trac/htdocs">
  Options Indexes MultiViews
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

# You need something like this to authenticate users
<Location "/cgi-bin/trac.cgi/login">
  AuthType Basic
  AuthName "NIM"
  AuthUserFile /var/www/trac.htpasswd
  Require valid-user
</Location>

#SVN dir
<Location /svn>
  DAV svn
  SVNParentPath /var/svn
</Location>
## ---END OF ADDITIONS---

</VirtualHost>

We need to enable the apache2 DAV mod with the following command:

sudo ln -s /etc/apache2/mods-available/dav.load /etc/apache2/mods-enabled/dav.load

I installed my Subversion repository at /var/svn/project. So I did a quick starting config of subversion with the following commands:

mkdir /var/svn
mkdir /var/svn/project
mkdir /tmp/project
mkdir /tmp/project/branches
mkdir /tmp/project/tags
mkdir /tmp/project/trunk
svnadmin create /var/svn/project
svn import /tmp/project file:///var/svn/project -m "initial import"
rm -rf /tmp/project

Some permissions changes and an apache restart are now needed:

sudo chown -R www-data /var/svn/project
sudo chown -R www-data /usr/share/trac
sudo apache2 -k restart

Test by going to http://servername/svn/project

If this works, 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/project. 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:

mkdir /var/trac
trac-admin /var/trac/project initenv
sudo chown -R www-data /var/trac/project

The "trac-admin" command above prompted me to enter the project name (project), the path to the trac environment (var/trac/project), and the path to the Trac templates directory (usr/share/trac/templates); then it printed out a bunch of stuff. If there are no errors you should now be able to surf to your Trac site at http://servername/cgi-bin/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 a complaint specifically about this missing file. 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

OPTIONAL: create a redirect file called /var/www.index.html with this one line:

<META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://10.0.0.102/cgi-bin/trac.cgi">

… with this change, you can get to Trac with http://servername instead of the more cumbersome http://servername/cgi-bin/trac.cgi

Note: See TracWiki for help on using the wiki.