How to Install Trac Project Management Tool on Ubuntu 18.04 LTS

Trac is a free and an open source Web-based project management and bug tracking system that helps developers to write great software while staying out of the way. You can easily integrate Trac with version control systems like Subversion and Git. Trac allows wiki markup in issue descriptions and commit messages, creating links and seamless references between bugs, tasks, changesets, files and wiki pages.

In this tutorial, we will learn how to install Trac on Ubuntu 18.04 LTS (Bionic Beaver).


  • A server running Ubuntu 18.04.
  • A non-root user with sudo privileges.

Install Apache

First, you will need to install Apache web server to your system. You can install Apache with the following command:

sudo apt-get install apache2 -y

Once Apache is installed, start Apache service and enable it to start on boot with the following command:

sudo systemctl start apache2
sudo systemctl enable apache2

Install and Configure Trac

By default, Trac is available in Ubuntu 18.04 repository. You can install Trac with the following command:

sudo apt-get install trac libapache2-mod-wsgi -y

Once Trac is installed, enable auth_digest module with the following command:

sudo a2enmod auth_digest

Next, you will need to create a web root directory for Trac. You can do this by running the following command:

sudo mkdir /var/lib/trac
sudo mkdir -p /var/www/html/trac
sudo chown www-data:www-data /var/www/html/trac

Next, create a project directory for Trac and give proper permissions with the following command:

sudo trac-admin /var/lib/trac/test initenv test sqlite:db/trac.db


Project environment for 'test' created.

You may now configure the environment by editing the file:


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 /var/lib/trac/test

Then point your browser to http://localhost:8000/test.
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

sudo trac-admin /var/lib/trac/test deploy /var/www/html/trac/test
sudo chown -R www-data:www-data /var/lib/trac/test
sudo chown -R www-data:www-data /var/www/html/trac/test

Next, create an admin user and hiroom2 user for Trac with the following command:

sudo htdigest -c /var/lib/trac/test/.htdigest "test" admin
sudo htdigest /var/lib/trac/test/.htdigest "test" hiroom2

Configure Apache for Trac

Next, you will need to create an Apache virtual host directive for Trac. You can do this by running the following command:

sudo nano /etc/apache2/sites-available/trac.conf

Add the following lines:

WSGIScriptAlias /trac/test /var/www/html/trac/test/cgi-bin/trac.wsgi
<Location /trac/test>
  AuthType Digest
  AuthName "test"
  AuthUserFile /var/lib/trac/test/.htdigest
  Require valid-user

Save and close the file, when you are finished.

Finally, enable Trac virtual host and restart Apache service with the following command:

sudo a2ensite trac.conf
sudo systemctl restart apache2

Access Trac Web Interface

Trac is now installed and configured, it's time to access Trac web interface.

Open your web browser and type the URL http://your-domain-name/trac/test, you will be redirected to the following page:

Login to Trac

Now, provide your admin user credentials and click on the Log In button, you should see the following page:

Trac Web Interface

Share this page:

Suggested articles

7 Comment(s)

Add comment


By: kennedy

ERROR: Site test does not exist! This is the error i get when i try running the "sudo a2ensite test" command

By: till


sudo a2enconf trac

instead or if this doe snotw ork use:

sudo a2enconf trac.conf

By: nocom

This instruction got me further than the trac site. But when I modify the trac.conf file acoording to your instruction the statement WSGIScriptAlias causes apache2 to not restart. Removing this line and all is ok. But I don' get a login in prompt, just a list of files in the test directory. Do you know what I did wrong?

By: g-man

I have 2 issues - I cannot get any password from the .htdigest to accept (password prompt keeps coming back) despite resetting password and restarting apache.

If I remove auth completely, I get a "forbidden" error from Apache, presumably as it is trying to find a directory.


Any dieas?

By: Robert

Thank you for the clear instructions! My first project works great but I need a second instance of trac that is completely isolated from the first with a different set of users and different ticket fields. Lets call it test2. After running the initenv command I get a test2 directory under /var/lib/trac but not under /var/www/html/trac. And failed attempts to access through browser http://hostname:port/trac/test2. Any help would be great. Thanks

By: Robert

Found a manual way to do this... copy the "/var/www/html/trac/test" directory to a new "test2" directory. It's only 1.5MBytes.

/var/www/html/trac$ sudo mkdir test2

/var/www/html/trac/test$ sudo cp -r ./cgi-bin /var/www/html/trac/test2

/var/www/html/trac/test$ sudo cp -r ./htdocs /var/www/html/trac/test2

make sure owner and permission match the "test" directories and files

#Replace all instances of test to test2:

/var/www/html/trac/test$ grep -r "test" .

./cgi-bin/trac.cgi:        os.environ['TRAC_ENV'] = '/var/lib/trac/test'

./cgi-bin/trac.wsgi:        environ.setdefault('trac.env_path', '/var/lib/trac/test')

./cgi-bin/trac.fcgi:        os.environ['TRAC_ENV'] = '/var/lib/trac/test'

Add a second Alias and Location block in trac.conf, replace "test" with "test2":

WSGIScriptAlias /trac/test2 /var/www/html/trac/test2/cgi-bin/trac.wsgi <Location /trac/test2> AuthType Digest AuthName "test2" AuthUserFile /var/lib/trac/test2/.htdigest Require valid-user </Location>

Restart server and access the new trac, test2 instance with :



By: Kalingarajan

I restore my files to new server its show in error message like below,

Oops… Trac detected an internal error: OperationalError: no such column: ipnr