Edgewall Software

Installing and Running Trac on Gentoo

Trac is included in Gentoo portage as of 2004/04/29. Installing is as simple as:

emerge trac

Past that, normal Trac configuration should apply. For the instructions below, read the generic TracInstall instructions about the recommended versions of the dependent packages.

A nice guide to setting up Trac on Gentoo here.

There were a couple of things that were required to make Trac on Gentoo work:

  • Make sure your berkdb and Python use flags are set.
  • If you have any trouble, go down to the bottom and start emerging components this is how I figured out that the svn bindings for Python weren't building, etc. Be sure to run the Python update script if needed.
  • Once built, your alias for /trac will be different from the TracInstall doc. It will look something like this:
Alias /trac "/var/www/yourdomainhere/htdocs/trac/"

This makes Trac all pretty, like you're used to seeing! Otherwise it's got essentially no layout.

Install Trac from Source

Attached is the ebuild to build trac from its source:trunk. To use it save and extract it to your PORTDIR_OVERLAY, normally:


Of course if you already don't have it there, add to your make.conf:


So, from scratch, add the above to your make.conf and:

mkdir /usr/local/portage/
mkdir /usr/local/portage/www-apps
cd /usr/local/portage/www-apps
wget http://projects.edgewall.com/trac/attachment/wiki/TracOnGentoo/trac-svn-1.tar
tar xvf trac-svn-1.tar
rm trac-svn-1.tar
mkdir /usr/local/portage/dev-python
cd /usr/local/portage/dev-python
wget http://projects.edgewall.com/trac/attachment/wiki/TracOnGentoo/pysqlite-2.3.2.tar
tar xvf pysqlite-2.3.2.tar
rm pysqlite-2.3.2.tar

To build from what Gentoo provides, although I havent tested like this, simply do:

emerge trac-svn -va

If you want to be on the edge like me:

echo =www-apps/trac-svn-1-r1 ~x86 >> /etc/portage/package.keywords
echo =dev-python/pysqlite-1.1.6 ~x86 >> /etc/portage/package.keywords
echo =dev-lang/swig-1.3.24 ~x86 >> /etc/portage/package.keywords
echo =dev-lang/swig-1.3.24 >> /etc/portage/package.unmask
echo =dev-util/subversion-1.2.1 ~x86 >> /etc/portage/package.keywords

And you'll probably will also need to do the following:

echo =net-www/apache-2.0.54-r13 ~x86 >> /etc/portage/package.keywords
echo =net-www/gentoo-webroot-default-0.2 ~x86 >> /etc/portage/package.keywords
echo =dev-libs/apr-0.9.6-r3 ~x86 >> /etc/portage/package.keywords
echo =dev-libs/apr-util-0.9.6-r2 ~x86 >> /etc/portage/package.keywords

Note: portage will complain, because this is NOT the right way to do it! You need to use the newer method to unmask masked packages. Please see http://gentoo-wiki.com/Masked for the right way to do this.

These are the ebuilds you can use:

dev-python/pysqlite-2.3.2 [cutom ebuild - see attached]

My two cents, 2006-02-24

(I'm fairly good with Gentoo).

I'm not sure berkdb needs to be set as mentioned above by another user. You do need to choose between SQLite and Postgresql though. Newer ebuilds don't assume SQLite. It may be a good idea to set this in /etc/portage/package.use, such as:

www-apps/trac enscript silvercity sqlite vhosts

There may be some instructions in the output from the ebuilds along the way. For instance, you may get this while emerging webapp-config:

 * Now that you have upgraded webapp-config, you **must** update your
 * config files in /etc/vhosts/webapp-config before you emerge any
 * packages that use webapp-config.

And later, while emerging Trac itself, I got this message because I enabled the vhosts USE flag:

 * The 'vhosts' USE flag is switched ON
 * This means that Portage will not automatically run webapp-config to
 * complete the installation.
 * To install trac-0.9.3 into a virtual host, run the following command:
 *     webapp-config -I -h <host> -d trac trac 0.9.3
 * For more details, see the webapp-config(8) man page

If you do not want Trac installed into a virtual host, you can remove the 'vhosts' USE flag, and the installation will continue through installing it at /trac on the default host:

 * vhosts USE flag not set - auto-installing using webapp-config
 * This is an installation
 * trac-0.9.3 is not installed - using install mode
 * Running //usr/sbin/webapp-config -I -h localhost -u root -d /trac trac 0.9.3
 *   Creating required directories
 *   Linking in required files
 *     This can take several minutes for larger apps
 *     trac-0.9.3 does not install any files from
 *       /usr/share/webapps/trac/0.9.3/htdocs
 *     trac-0.9.3 does not install any files from
 *       /usr/share/webapps/trac/0.9.3/hostroot
 *   Files and directories installed

Personal use, 2010/08

For Trac-0.12 no Postgres/MySQL, SQLite used:

# emerge -vu apache mod_python trac
# webapp-config -I -h localhost -d /trac trac 0.12
# vim /etc/conf.d/apache2 # APACHE2_OPTS += "-D PYTHON"
# trac-admin /var/lib/trac/my_trac initenv
# echo \
'<LocationMatch "/my_trac">
                SetEnv PYTHON_EGG_CACHE /var/lib/trac/egg-cache
                SetHandler mod_python
                PythonHandler trac.web.modpython_frontend
                PythonOption TracEnv /var/lib/trac/my_trac
                PythonOption TracUriRoot /trac/

<Location /my_trac/login>
  AuthType Basic
  AuthName "my_trac"
  AuthUserFile /var/lib/trac/my_trac/.htpasswd
  Require valid-user
' >> /etc/apache2/vhosts.d/default_vhost.include
#htpasswd /var/lib/trac/my_trac/.htpasswd
#chown -R apache:apache /var/lib/trac/*
#/etc/init.d/apache2 restart

Last modified 8 years ago Last modified on Oct 26, 2015, 8:01:01 PM

Attachments (3)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.