| 1 | = Installing and Running Trac on Debian = |
| 2 | |
| 3 | The Debian Sid and Sarge distributions already contain Trac and all required dependencies. You can track version numbers at http://packages.debian.org/trac. |
| 4 | Debian Woody users need to add a few lines to their '''/etc/apt/sources.list''' before installing Trac. |
| 5 | |
| 6 | For Woody: |
| 7 | {{{ |
| 8 | # Trac, clearsilver, sqlite, pysqlite |
| 9 | deb http://ftp.edgewall.com/pub/debian woody trac |
| 10 | # Subversion, Apache2 |
| 11 | deb http://people.debian.org/~adconrad woody subversion |
| 12 | }}} |
| 13 | |
| 14 | For Sarge users who want to track Edgewall's versions: |
| 15 | {{{ |
| 16 | # Trac and clearsilver |
| 17 | deb http://ftp.edgewall.com/pub/debian sarge trac |
| 18 | }}} |
| 19 | |
| 20 | Run |
| 21 | {{{ |
| 22 | $ apt-get update |
| 23 | }}} |
| 24 | after editing the file to update the package cache. |
| 25 | |
| 26 | Installing Trac and the required dependencies should now be as simple as: |
| 27 | {{{ |
| 28 | $ apt-get install trac |
| 29 | }}} |
| 30 | |
| 31 | '''Note:''' While installing Trac on Debian Woody you might get some harmless warnings when the installation process byte-compiles some source files. |
| 32 | ---- |
| 33 | '''More notes for Trac 0.8 on Debian Woody:''' |
| 34 | |
| 35 | Notice, this is what worked for me on a '''new''' Woody system I built just to host Trac (in a VMware image, yet!), so I was able to be a little free with modifications I made. Be more careful if you are adding Trac to a system you use for other tasks - don't blame me if these instructions break something! |
| 36 | |
| 37 | These instructions ignore the above and start at the very beginning. |
| 38 | |
| 39 | * Subversion really wants Apache2 installed. If you run {{{apache2 -v}}} and get an error, you'll need to install Apache2. |
| 40 | I removed apache 1.3 and installed Apache2 with the following: |
| 41 | {{{ |
| 42 | apt-get install apache2-common apache2-doc apache2-mpm-worker libapache2-svn |
| 43 | apt-get remove apache |
| 44 | apache2 -k start |
| 45 | }}} |
| 46 | Also, edit /etc/default/apache2 so it says {{{NO_START=0}}} if you want apache2 to run on boot. |
| 47 | |
| 48 | * Trac 0.8 runs better with Python 2.2 and python-xml (without them, diffs and attachment uploading ''will not'' work). '''Note''' that Trac's email notifications will not work unless you have Python 2.2.2 or greater. Since I couldn't find a Debian/stable .deb for anything higher than Python 2.2.1, I gave up on email notifications. Everything else seems to be workng though! |
| 49 | {{{ |
| 50 | apt-get install python2.2-xmlbase python2.2-sqlite |
| 51 | cd /usr/bin |
| 52 | mv python python.orig |
| 53 | ln -s python2.3 python |
| 54 | cp -R /usr/lib/python2.1/site-packages /usr/lib/python2.3 |
| 55 | apache2 -k restart |
| 56 | }}} |
| 57 | |
| 58 | ---- |
| 59 | |
| 60 | * Be careful with the above steps. I attempted to follow them on an "existing" (i.e. not fresh) woody box and was unsuccessful in part because I had managed to install a newer version of subversion from source before deciding to try the packages. I decided to bite the bullet and upgrade to sarge so I could use the goodness that is apt while also using fsfs repositories. Aside from breaking my pptpd install, the upgrade only partially solved my trac/subversion woes; I was able to get apache2-mod-svn working, but trac-admin from the command line would fail when one of the subversion Python modules went looking for libswig1.3.21 and I had only libswig1.3.22; symlinking libswig1.3.21.so -> libswig1.3.22.so solved that problem but left me with another error in fs.py when running trac-admin help from the command line. After much gnashing of teeth, I tried removing the subversion package and the trac package; this triggered an uninstall of several then-unused support packages, including python2.3. However, /usr/lib/python2.3 still existed and was not empty, despite the apt database showing absolutely no python packages of any version installed. I manually rm'd /usr/lib/python2.3, did an aptitude install subversion trac, and stuff worked; I'm fairly convinced that the manual reworkings of the python install (as described above) were directly related, if not causative, in the problem; the fix could have been as simple as: |
| 61 | {{{ |
| 62 | aptitude remove subversion trac python2.3 |
| 63 | rm -r /usr/lib/python2.3 |
| 64 | aptitude install subversion trac python2.3 |
| 65 | }}} |
| 66 | after I had upgraded to sarge. The removal of python2.3 and the rm of /usr/lib/python2.3 are critical; prior to doing this, I had also tried removing subversion and trac and reinstlling, first from binary and then from source packages; that didn't help. |
| 67 | |
| 68 | * Sorry you had issues, but please note I made the python choices shown specifically for '''Woody'''. Your issues stem from being upgraded to Sarge. python2.3 wasn't available in woody when I wrote these instructions, and I made careful note of that. I too had more than a few problems with python (hence these instructions!), so I know where you're coming from. But pure Woody users won't have access to python2.3 as far as I know. |
| 69 | ---- |
| 70 | |
| 71 | * After completing these pre-requisites, I added the following to /etc/apt/sources.list |
| 72 | {{{ |
| 73 | deb http://ftp.edgewall.com/pub/debian woody trac |
| 74 | deb http://people.debian.org/~adconrad woody subversion |
| 75 | }}} |
| 76 | and ran |
| 77 | {{{ |
| 78 | apt-get install trac |
| 79 | }}} |
| 80 | * Getting Subversion working: |
| 81 | |
| 82 | I decided to keep my Subversion project at /var/svn/project. Here are the commands I entered to get SVN up and running: |
| 83 | {{{ |
| 84 | mkdir /var/svn |
| 85 | mkdir /var/svn/project |
| 86 | mkdir /tmp/project |
| 87 | mkdir /tmp/project/branches |
| 88 | mkdir /tmp/project/tags |
| 89 | mkdir /tmp/project/trunk |
| 90 | svnadmin create /var/svn/project |
| 91 | svn import /tmp/project file:///var/svn/project -m "initial import" |
| 92 | rm -rf /tmp/project |
| 93 | }}} |
| 94 | I added the following to /etc/apache2/sites-available/default: |
| 95 | {{{ |
| 96 | #SVN dir |
| 97 | <Location /svn> |
| 98 | DAV svn |
| 99 | SVNParentPath /var/svn |
| 100 | </Location> |
| 101 | }}} |
| 102 | Then I fixed permissions and restarted apache2: |
| 103 | {{{ |
| 104 | chown www-data /var/svn/project |
| 105 | chown -R www-data /var/svn/project/* |
| 106 | apache2 -k restart |
| 107 | }}} |
| 108 | I was able to test by going to !http://servername.foo.com/svn/project where I could see the empty directories as imported. I did not move on to the next step until this worked right! |
| 109 | |
| 110 | * Getting Trac running: |
| 111 | |
| 112 | I put my trac environment at /var/trac/project. I'm not using the mod_python extentions at the moment. First I ran |
| 113 | {{{ |
| 114 | mkdir /var/trac |
| 115 | trac-admin /var/trac/project initenv |
| 116 | chown -R www-data /var/trac/project |
| 117 | }}} |
| 118 | The "trac-admin" command above prompted me to enter the project name, the path to the trac environment, and the path to the Trac templates directory; then it printed out a bunch of stuff. |
| 119 | |
| 120 | Next, I edited /etc/apache2/sites-available/default. I commented out the existing {{{ScriptAlias}}} and {{{<Directory "/usr/lib/cgi-bin">}}} directives, and added this at the end: |
| 121 | {{{ |
| 122 | Alias /trac "/usr/share/trac/htdocs" |
| 123 | ScriptAlias /cgi-bin/ /usr/share/trac/cgi-bin/ |
| 124 | <Location "/cgi-bin/trac.cgi"> |
| 125 | SetEnv TRAC_ENV "/var/trac/project" |
| 126 | </Location> |
| 127 | |
| 128 | <Directory "/usr/share/trac/htdocs"> |
| 129 | Options Indexes MultiViews |
| 130 | AllowOverride None |
| 131 | Order allow,deny |
| 132 | Allow from all |
| 133 | </Directory> |
| 134 | |
| 135 | # You need something like this to authenticate users |
| 136 | <Location "/cgi-bin/trac.cgi/login"> |
| 137 | AuthType Basic |
| 138 | AuthName "project" |
| 139 | AuthUserFile /var/www/trac.htpasswd |
| 140 | Require valid-user |
| 141 | </Location> |
| 142 | }}} |
| 143 | Now to fix the permissions, add a couple of users, and restart Apache: |
| 144 | {{{ |
| 145 | cd /var/www |
| 146 | htpasswd -c trac.htpasswd user1 (you'll be prompted for the password) |
| 147 | htpasswd trac.htpasswd bar user2 (you'll be prompted for the password) |
| 148 | apache2 -k restart |
| 149 | }}} |
| 150 | Finally, test by going to !http://servername.foo.com/cgi-bin/trac.cgi |
| 151 | |
| 152 | On my installation, I do get some errors ("Python C API version mismatch for module ''blah''") when I run trac-admin at the commandline. Apache also logs similar errors. This is probably because I didn't upgrade to Python2.2 until ''after'' I installed Trac. Hopefully these errors will be avoided by upgradng Python first (as I have advised above), but in any case they don't seem to hurt Trac at all. Everything (except email notifications which I don't need anyway) works perfectly! |
| 153 | ---- |
| 154 | Furthermore, there is a guide on building the Debian Trac package from the trunk at TracOnDebianFromTrunk |