wiki:trac

Basic installation

sudo apt-get update
sudo apt-get install python
sudo apt-get install sqlite3
sudo apt-get install python-pip
sudo pip install --upgrade pip
sudo pip install Babel
sudo pip install docutils
sudo pip install pygments
sudo pip install pytz
sudo pip install trac
sudo mkdir /var/www
sudo mkdir /var/www/trac
sudo chown joerg:joerg /var/www/trac
trac-admin /var/www/trac initenv

Starten des Dienstes

tracd -s --port 8000 --auth=trac,/home/joerg/auth.file,trac /var/www/trac

Anlegen von Benutzern

#!/usr/bin/python

from optparse import OptionParser
# The md5 module is deprecated in Python 2.5
try:
    from hashlib import md5
except ImportError:
    from md5 import md5
realm = 'trac'

# build the options
usage = "usage: %prog [options]"
parser = OptionParser(usage=usage)
parser.add_option("-u", "--username",action="store", dest="username", type = "string",
                  help="the username for whom to generate a password")
parser.add_option("-p", "--password",action="store", dest="password", type = "string",
                  help="the password to use")
parser.add_option("-r", "--realm",action="store", dest="realm", type = "string",
                  help="the realm in which to create the digest")
(options, args) = parser.parse_args()

# check options
if (options.username is None) or (options.password is None):
   parser.error("You must supply both the username and password")
if (options.realm is not None):
   realm = options.realm
   
# Generate the string to enter into the htdigest file
kd = lambda x: md5(':'.join(x)).hexdigest()
print ':'.join((options.username, realm, kd([options.username, realm, options.password])))

mit ./digest -u joerg -p password >> auth.file aufrufen.

Starten des Dienstes dann mit

tracd -s --port 8000 --auth=trac,/home/joerg/auth.file,trac /var/www/trac

'Hierbei beachten': Die Parameter in auth (1) Nicht der gegebene Projektname, sondern das letzte Verzeichnis im Pfad zum Projekt (2) Die Auth-Datei (3) Realm, wie im python-script gesetzt.

Konfiguration mit Proxy

Edit apache2 virtual host config and add Reverse proxy and rewriting-configuration:

# from http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass
RewriteEngine On
RewriteCond %{HTTPS} =off
RewriteRule . - [E=protocol:http,E=port:8000]
RewriteCond %{HTTPS} =on
RewriteRule . - [E=protocol:https,E=port:8000]
# SSLProxyEngine on
ProxyPassReverse /trac/ http://trac:8000/trac/
ProxyPass /trac/ http://trac:8000/trac/

Furthermore use base path option for starting trac:

tracd -s --port 8000 --base-path=/trac/ --auth=trac,/home/joerg/auth.file,trac /var/www/trac

Plugin für Blogs

Download https://trac-hacks.org/browser/fullblogplugin?rev=17126&format=zip Unzip file, cd in unzipped directory and version directory, run sudo python setup.py install Run trac-admin "/var/www/trac" upgrade and trac-admin "/var/www/trac" wiki upgrade Restart trac.

Last modified 4 months ago Last modified on Apr 25, 2018, 10:56:32 AM