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).

Requirements

  • 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

Output:

Project environment for 'test' created.

You may now configure the environment by editing the file:

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

  http://trac.edgewall.org/

Congratulations!
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
</Location>

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:

7 Comment(s)