= Trac on Ubuntu = [[PageOutline]] {{{ #!div class=important '''Help wanted:''' The various Ubuntu specific install docs should be cleaned and merged where that makes sense... }}} * Back to TracInstallPlatforms * TracInstall - See this before reading any distro specific tutorial '''Note:''' It is always best practice to use the latest [wiki:WikiStart stable version] of Trac. ||= tutorial =||= Ubuntu Version =||= Trac Version =||= Apache =||= VCS =||= Database =|| || [wiki:Ubuntu-11.04-Subversion Ubuntu-10.04-Subversion] || 10.04 || 0.12 || Mod_Python || Subversion || MySQL|| || [wiki:Ubuntu-10.04-Bazaar] || 10.04 || 0.12 || Mod_WSGI || Bazaar || MySQL|| || [https://help.ubuntu.com/community/Trac ubuntu Help] || ?|| ?|| Mod_Python || ?|| SQLite|| || [wiki:0.11/TracOnUbuntu] || 8.04 || 0.11 || Mod_Python || Subversion || SQLite|| || [wiki:0.11/TracOnUbuntuHardy hardy, cgi] || 8.04 || 0.11 || ~~CGI~~ || Subversion || SQLite|| || TracUbuntuMultipleProjects || 8.04 || 0.11 || Mod_Python || Subversion || SQLite|| || [wiki:0.10.4/TracOnUbuntuHardy] || 8.04 || 0.10.4 || Mod_Python || Subversion || SQLite|| || TracFeisty || 7.04 || ?|| Mod_Python || Subversion || SQLite|| || TracInstallUbuntu || ?|| 0.11.5 || Mod_Python || ?|| SQLite|| || [https://help.ubuntu.com/community/UbuntuTracHowto Ubuntu-Trac] || ?|| ?|| Mod_Python || Subversion || SQLite|| || [wiki:TracOnUbuntuBreezer Ubuntu 5.10 "The Breezy Badger"] || 5.10 || ?|| Mod_Python || Subversion || SQLite|| || [wiki:TracOnUbuntuBreezyWorkingenv Ubuntu 5.10 with workingenv] || 5.10 || ?|| Fast_CGI || ?|| SQLite|| '''DB:''' Most tutorials do not say the database they are using. I assume the default is SQLite. '''Ubuntu 8.04.2 Hardy Note:''' the default package installs trac-post-commit-hook under /usr/share/doc/trac/contrib path. Unfortunately this script is not working correctly with Trac 0.11 and you need to download the latest version from [source:0.11-stable/contrib/trac-post-commit-hook]. == Installing Trac on Ubuntu This is a short recipe to install and configure virtual `Apache2` host with `Trac` === Which Ubuntu packages are needed Typical procedure to install Trac under Ubuntu with its default dependencies (default - choosed by apt) is {{{#!sh apt-get install python python-babel apt-get install trac }}} Ensure that python version matches Trac latest, otherwise apt will install older Trac version which matches your old python package installed. Also take into account that `python-babel` should be always installed before `trac` if you wish to see it internationalized. ==== Upgrade python packages Ubuntu pre-packaged python resources are not always newest, and you may consider to upgrade them with `easy_install` or `pip` - Upgrade with `easy_install` {{{#!sh easy_install Babel easy_install Trac }}} - Upgrade with `pip` (another python installer, namely `python-pip`) {{{#!sh apt-get install python-pip pip install --upgrade Babel pip install --upgrade Trac }}} === Configuring virtual host Here is shown sample virtual host configuration running under `apache2` (one file) with minimal, "entry level" settings. Config file created at `apache2` known place for site configs (see below), and then configured site can be "enabled" to run. The following considerations used within this config, yours may vary, so adjust them below appropriately at your own - `trac.local` is a hostname of virtual host - `/var/local/trac` is a directory (Trac project) at that host - `/var/local/trac/.htpasswd` is a password file created with `htpasswd` utility - `ru_RU.UTF8` is a locale ident ==== Prepare configuration First you need to - create directory for Trac project and change its access permissions to that under which `apache2` runs (`www-data` in most cases) - initialize `Trac` environment within that directory - create `apache2` htpasswd entry for authorized web user access within this directory - add to Trac this authorized web user with administrative privileges over Trac {{{#!sh mkdir -p /var/local/trac && chown www-data: /var/local/trac trac-admin /var/local/trac initenv htpasswd -c /var/local/trac/.htpasswd adminusername trac-admin /var/local/trac permission add adminusername TRAC_ADMIN }}} Create config file with any text editor (`vi` in this example): {{{#!sh vi /etc/apache2/sites-available/trac }}} Enter the following copy-paste into this file: {{{#!text/html ServerName trac.local SetHandler mod_python PythonInterpreter main_interpreter PythonHandler trac.web.modpython_frontend PythonOption TracEnv /var/local/trac PythonOption TracEnvParentDir /var/local/trac PythonOption TracUriRoot / PythonOption TracEnv /var/local/trac # PythonOption TracEnvIndexTemplate /var/local/trac/templates/index-template.html PythonOption TracLocale en_US.UTF8 PythonOption PYTHON_EGG_CACHE /tmp Order allow,deny Allow from all AuthType Basic AuthName "myproject" AuthUserFile /var/local/trac/.htpasswd Require valid-user }}} ==== Enable prepared configuration {{{#!sh a2enmod python a2ensite trac service apache2 restart }}}