Home > Articles > Ubuntu > Installing Trac

In Brief: Installing Trac

10 sep 2006, Simon Strandgaard

server is Ubuntu linux

prompt> uname -a
Linux 2.6.15-26-server #1 SMP Thu Aug 3 04:09:15 UTC 2006 i686 GNU/Linux

See TracOnUbuntu.

STEP1: install the package

prompt> sudo aptitude

choose trac + sqlite for installation.

STEP2: configuration

prompt> sudo adduser trac
prompt> sudo su trac
prompt> cd
prompt> trac-admin my_project initenv
Creating a new Trac environment at /home/trac/my_project

Trac will first ask a few questions about your environment 
in order to initalize and prepare the project database.

 Please enter the name of your project.
 This name will be used in page titles and descriptions.

Project Name [My Project]> My Project

 Please specify the connection string for the database to use.
 By default, a local SQLite database is created in the environment 
 directory. It is also possible to use an already existing 
 PostgreSQL database (check the Trac documentation for the exact 
 connection string syntax).

Database connection string [sqlite:db/trac.db]>

 Please specify the absolute path to the project Subversion repository.
 Repository must be local, and trac-admin requires read+write
 permission to initialize the Trac database.

Path to repository [/var/svn/test]> /home/svn/repo

 Please enter location of Trac page templates.
 Default is the location of the site-wide templates installed with Trac.

Templates directory [/usr/share/trac/templates]> 

Creating and Initializing Project
Project environment for 'My Project' created.

You may now configure the environment by editing the file:

  /home/trac/my_project/conf/trac.ini

If you'd like to take this new project environment for a test drive,
try running the Trac standalone web server `tracd`:

  tracd --port 8000 /home/trac/my_project

Then point your browser to http://localhost:8000/my_project.
There you can also browse the documentation for your installed
version of Trac, including information on further setup (such as
deploying Trac to a real web server).

The latest documentation can also always be found on the project
website:

  http://projects.edgewall.com/trac/

Congratulations!

prompt>

STEP3: verify that Trac works

prompt> tracd --port 8000 /home/trac/my_project

point your browser to: http://192.168.1.2:8000/
press CTRL-C to terminate tracd.

STEP4: apache running Trac as a CGI program

prompt> sudo chown -R trac:www-data my_project
prompt> ls -l
drwxrwxr-x  10  trac  www-data  4096  2006-09-10  05:34  my_project
prompt> sudo vi /etc/apache2/apache2.conf

insert this

ScriptAlias /trac /usr/share/trac/cgi-bin/trac.cgi
<Location /trac>
    SetEnv TRAC_ENV "/home/trac/my_project"
</Location>

now restart the webserver

prompt> sudo apache2ctl restart

point your browser to: http://192.168.1.2/trac/