| 1 | Read [wiki:TracInstall] first for a general overview. This is a quick HOWTO specifically for Ubuntu users. I wrote these notes during an install on Ubuntu Hardy Heron. |
| 2 | |
| 3 | I consulted: |
| 4 | |
| 5 | * The Trac INSTALL file |
| 6 | * [wiki:TracInstall] |
| 7 | * [wiki:TracModPython] |
| 8 | |
| 9 | I ran the following commands as root: |
| 10 | |
| 11 | {{{ |
| 12 | cd /usr/local/src |
| 13 | wget http://ftp.edgewall.com/pub/trac/Trac-0.11.1.tar.gz |
| 14 | tar -zxf Trac-0.11.1.tar.gz |
| 15 | cd Trac-0.11.1 |
| 16 | apt-get install python-devel: there isn't one. |
| 17 | apt-get install python-xml |
| 18 | apt-get install python-genshi |
| 19 | apt-get install python-subversion |
| 20 | apt-get install python-pysqlite2 |
| 21 | apt-get install python-setuptools |
| 22 | apt-get install libapache2-mod-python |
| 23 | python ./setup.py install |
| 24 | }}} |
| 25 | |
| 26 | Note: the libapache2-mod-python install hung on the first try. It succeeded when I interrupted it and tried again. |
| 27 | |
| 28 | Now we need a folder the web server is allowed to write to in which to keep Trac's data. So we'll make that folder and then switch to the www-data user for the next few commands: |
| 29 | {{{ |
| 30 | mkdir /usr/local/trac |
| 31 | chown www-data.www-data /usr/local/trac |
| 32 | su www-data |
| 33 | svnadmin create /usr/local/trac/repository |
| 34 | trac-admin /usr/local/trac/environment initenv |
| 35 | }}} |
| 36 | The trac-admin command will prompt you for various settings. You can accept the defaults, except for the Subversion repository, which you should set to /usr/local/trac/repository. |
| 37 | {{{ |
| 38 | htpasswd -c /usr/local/trac/passwords.txt admin |
| 39 | }}} |
| 40 | Supply a password for an initial user. You can add more users later. Use the -c option only on the FIRST use of this command, as it creates the password file. |
| 41 | |
| 42 | Now it's time to switch back to root to configure Apache. Type exit to log out of the www-data account and return to root. Now set up a virtual host for Trac. Let's say it will be called tractest. You can set it up by creating the file /etc/apache2/sites-available/tractest with the following contents: |
| 43 | {{{ |
| 44 | <VirtualHost *> |
| 45 | ServerName tractest |
| 46 | <Location /> |
| 47 | SetHandler mod_python |
| 48 | PythonInterpreter main_interpreter |
| 49 | PythonHandler trac.web.modpython_frontend |
| 50 | PythonOption TracEnv /usr/local/trac/environment |
| 51 | PythonOption TracUriRoot / |
| 52 | </Location> |
| 53 | <Location /login> |
| 54 | AuthType Basic |
| 55 | AuthName "trac" |
| 56 | AuthUserFile /usr/local/trac/passwords.txt |
| 57 | Require valid-user |
| 58 | </Location> |
| 59 | |
| 60 | </VirtualHost> |
| 61 | }}} |
| 62 | Now, as root, signal Apache to reload its configuration and notice the new site: |
| 63 | |
| 64 | {{{ |
| 65 | invoke-rc.d apache2 reload |
| 66 | }}} |
| 67 | |
| 68 | Finally, add tractest to your DNS or, if you're just setting up a test site for your own use on your own computer, add it to the list of aliases for localhost in your /etc/hosts file: |
| 69 | {{{ |
| 70 | # List testing sites here |
| 71 | 127.0.0.1 localhost tractest |
| 72 | }}} |
| 73 | You're ready to go. Visit http://tractest/ and you'll have access to trac. You can log in as the admin user when you click on the login button. |
| 74 | |
| 75 | Of course basic authentication isn't the only option. Anything that is backwards-compatible with it should work, including mod_ldap, mod_shib, etc. |
| 76 | |
| 77 | - Tom Boutell, [http://www.punkave.com/] |
| 78 | |