||<>|| ''For alternative installation methods have a look at the parent page: [[Trac]]'' = Before we start = A couple of remarks before we start: == PIP-based Installation == Although the stable version of Trac (0.12) was released in June 2010, Ubuntu Oneiric still ships with the (deprecated) 0.11 version of Trac. Therefore '''''this tutorial will use Python's PIP installer tool'''''. == Web-server Choice == Trac can run either on top of its own, standalone server (tracd) or on top of several generic web-servers, such as Apache, nginx, IIS etc. Even then, several plug-ins can be used on top of the web-server: Apache + FastCGI, Apache + mod_wsgi, Apache + mod_python, IIS + AJP, etc. '''''This tutorial will use the Apache + mod_wsgi combination.''''' == Database Choice == Trac defaults to SQLite for a database. PostgreSQL is also fully supported. MySQL is problematic, and [[http://trac.edgewall.org/wiki/MySqlDb|the Trac Wiki states]]: ''supporting this database has proven to be painful at times. We recommend that you use it only if you don't have other choice.'' '''''This tutorial will use SQLite for simplicity.''''' == Authentication Methods == '''''This tutorial uses Apache's [[http://httpd.apache.org/docs/2.2/mod/mod_auth_basic.html|basic]] authentication method (mod_auth_basic).''''' However, [[http://trac.edgewall.org/wiki/TracModWSGI#ConfiguringAuthentication|it is recommended]] that you either enable SSL or at least use the "digest" authentication scheme instead of "Basic". == Version Control Systems == Trac is tightly integrated with the Subversion (SVN) VCS and defaults to that one out of the box. It's possible to [[http://trac.edgewall.org/wiki/VersionControlSystem|use other VCSs through plug-ins]]. '''''This tutorial will use the Mercurial (HG) VCS.''''' = Installation Instructions = 1. First, install PIP: {{{ sudo apt-get install python-pip }}} 1. Install Trac using PIP: {{{ sudo pip install trac }}} 1. Initialize by typing: {{{ sudo trac-admin /opt/trac initenv }}} (replace '''/opt/trac''' with the installation path of your choice). You will be asked for the project-name and the database connection. 1. Install Apache2, mod_wsgi: {{{ sudo apt-get install apache2 libapache2-mod-wsgi }}} 1. Configure WSGI by running: {{{ sudo trac-admin /opt/trac deploy /opt/trac }}} which will create a '''/opt/trac/cgi-bin/trac.wsgi''' file. 1. Configure Apache by adding the following to '''/etc/apache2/sites-available/trac''': {{{ WSGIScriptAlias /trac /opt/trac/cgi-bin/trac.wsgi WSGIApplicationGroup %{GLOBAL} Order deny,allow Allow from all }}} 1. Give Apache the required privileges: {{{ sudo chown -R www-data /opt/trac }}} 1. Enable the "trac" site in Apache: {{{ sudo a2ensite trac }}} 1. Restart Apache: {{{ sudo service apache2 restart }}} Now point your browser to http://localhost/trac and you should see Trac's welcome screen If you want to remove all the default wiki pages added during initenv, type: {{{ sudo trac-admin /opt/trac wiki remove * }}} == Configuring Authentication == 1. You can add the first user like this: {{{ sudo htpasswd -c /opt/trac/htpasswd firstuser }}} (replace first-user with your user-name of choice), and the following users with {{{ sudo htpasswd /opt/trac/htpasswd nextuser }}} 1. Add the following to '''/etc/apache2/sites-available/trac''': {{{ AuthType Basic AuthName "trac" AuthUserFile /opt/trac/htpasswd Require valid-user }}} 1. Remember to restart Apache: {{{ sudo service apache2 restart }}} 1. To grant administrator rights to a user, run: {{{ sudo trac-admin /opt/trac permission add username TRAC_ADMIN }}} == Enabling Mercurial == For more details, read [[http://trac.edgewall.org/wiki/TracMercurial|TracMercurial]] 1. Install subversion if you haven't already done so: {{{ sudo apt-get install subversion }}} 1. Download the plugin's source code: {{{ svn co http://svn.edgewall.com/repos/trac/plugins/0.12/mercurial-plugin }}} 1. Build and install the "egg": {{{ cd mercurial-plugin && python setup.py bdist_egg && sudo python setup.py install }}} 1. Edit '''/opt/trac/conf/trac.ini''': {{{ [components] tracext.hg.* = enabled [trac] repository_type = hg repository_dir = /path/to/my/hg/repository }}} 1. Restart Apache: {{{ sudo service apache2 restart }}} == Syntax High-lighting == If you want syntax highlighting when browsing the source code, just install '''pygments''': {{{ sudo apt-get install python-pygments }}} and restart Apache. ----