So einfach wie nie zuvor unter Mac OS X (Intel).
Für meine privaten Entwicklungsprojekte verwende ich Subversion zur SourceCode-Verwaltung und Trac als Issue- und Projektmanagementsystem. Unter Mac OS X Tiger war die Installation sehr schwierig, da nur Apache 1.3 vorinstalliert war und kein Subversion vorhanden war. Bei Leopard ist allerdings sowohl Subversion, als auch Python 2.5, Apache 2.2 etc. vorinstalliert und es bedarf nur noch ein bisschen Konfiguration, bis wir loslegen können.
Die Installation von Subversion ist auf dieser Seite perfekt beschrieben. Dieser Artikel wird sich nur auf die Installation und Konfiguration von Trac beziehen, da dies im oben verlinkten Artikel mit fast_cgi durchgeführt wird und ich dies lieber mit mod_python mache.
Der Artikel verwendet fast_cgi deshalb, da das von Apple mitgelieferte mod_python nicht für 64-bit übersetzt wurde, der Apache aber im 64-bit Modus läuft. Wir müssen uns also die Quellen des Paketes laden und selbst eine 64-bit Version übersetzen. Hierfür ist die Installation der Apple Developer Tools von der Mac OS X DVD notwendig! (Wem dies zu aufwändig ist, der kann natürlich die fast_cgi Variante aus dem verlinkten Artikel benutzen)
Das Paket mod_python (aktuell in der Version 3.3.1) bekommen wir von Apache selbst: http://httpd.apache.org/modules/python-download.cgi
Nach dem Download wechseln wir ins /tmp-Verzeichnis, entpacken die Quellen und rufen das configure-Skript auf:
# cd /tmp
# tar xzf ~/Download/mod_python-3.3.1.tgz
# cd mod_python
# ./configure --with-apxs=/usr/sbin/apxs
Nun müssen wir das entsprechende Makefile anpassen um eine 64-bit Version erzeugen zu können. Hier die Unterschiede in der Datei:
--- Makefile 2008-02-23 11:22:23.000000000 +0100
+++ Makefile.patched.3.3.1 2008-02-23 11:24:25.000000000 +0100
@@ -24,7 +24,7 @@
LEX=/usr/bin/flex
INCLUDES=-I/tmp/mod_python-3.3.1/src/include -I/usr/include/apache2 -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
LIBS=-lm -framework Python -ldl
-LDFLAGS= -Wl,-framework,Python -u _PyMac_Error -framework Python -Wl,-F.
+LDFLAGS= -Wl,-framework,Python -u _PyMac_Error -framework Python -Wl,-F. -arch x86_64
OPT=
CFLAGS=$(OPT) $(INCLUDES)
srcdir=.
@@ -46,7 +46,7 @@
@echo
@echo 'Compiling for DSO.'
@echo
- $(APXS) $(INCLUDES) -c $(SRCS) $(LDFLAGS) $(LIBS)
+ $(APXS) $(INCLUDES) -c -Wc,"-arch x86_64" $(SRCS) $(LDFLAGS) $(LIBS)
@rm -f mod_python.so
@ln -s .libs/mod_python.so mod_python.so
clean:
Die heruntergeladene Datei wird jetzt an den korrekten Platz kopiert, mod_python übersetzt und direkt im Anschluss überprüft:
# cd ~/Download/Makefile.patched.3.3.1 ./src/Makefile
# make
(...)
# file /tmp/mod_python-3.3.1/src/.libs/mod_python.so
/tmp/mod_python-3.3.1/src/.libs/mod_python.so: Mach-O 64-bit bundle x86_64
Wenn die Ausgabe der abgebildeten entspricht, können wir mod_python installieren:
# sudo make install
mod_python ist jetzt installiert. Wir installieren noch schnell Trac und konfigurieren im Anschluss daran Apache:
# sudo easy_install Pygments
(...)
# sudo easy_install Genshi
(...)
# sudo easy_install Trac
(...)
Unglaublich, aber wahr: Trac (0.11b1) und alle Abhängigkeiten sind installiert
Jetzt kommt noch mal etwas Konfigurationsarbeit für den Apache und danach sollte alles laufen.
Zuerst erzeugen wir die beiden Dateien, die wir benötigen:
# touch /private/etc/apache2/extra/httpd-python.conf
# touch /private/etc/apache2/extra/httpd-trac.conf
Danach kommt folgender Inhalt in die Datei httpd-python.conf:
LoadModule python_module libexec/apache2/mod_python.so
<Location>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler mod_python.testhandler
</Location>
Die Datei httpd-trac.conf wird in Anlehnung an den oben verlinkten Artikel mit folgendem Inhalt gefüllt:
<Location /trac>
SSLRequireSSL
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvDir /usr/local/trac
PythonOption TracUriRoot /trac
</Location>
<LocationMatch "/trac/login">
AuthType Basic
AuthName "TRAC Project"
AuthUserFile /private/etc/apache2/subversion.auth
Require valid-user
</LocationMatch>
Jetzt noch die Datei httpd.conf anpassen und die beiden neuen Dateien am Ende der Konfigurationsdatei laden:
# mod_python
Include /private/etc/apache2/extra/httpd-python.conf
# trac
Include /private/etc/apache2/extra/httpd-trac.conf
Das war’s schon! Nach einem Neustart des Apache (siehe unten) sollte unter https://localhost/trac das frisch installierte und konfigurierte Trac zur Verfügung stehen.
# sudo apachectl restart
Übrigens, die oben definierte Location /mpinfo ist das Infosystem von Python und steht jetzt unter folgender Url zur Verfgung: http://localhost/mpinfo/
November 8th, 2008 at 7:23 pm
Hi!
Works, but some quirks: you did not put the /mpinfo in the location tag of the httpd-python.conf.
and you probably need to use the full path for the python module location:
LoadModule python_module /usr/libexec/apache2/mod_python.so
Best, ALEXander.
November 8th, 2008 at 7:37 pm
and: the python environment variable is called TracEnv, and not TracEnvDir
November 8th, 2008 at 7:50 pm
und nochmal: trac authentication funktioniert nicht mit deinem httpd-trac.conf skript bei mir, aber das hier geht:
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /Users/ALEXander/Development/trac
PythonOption TracUriRoot /trac
AuthType Basic
AuthName “TRAC Project”
AuthUserFile /private/etc/apache2/subversion.auth
Require valid-user
November 3rd, 2009 at 7:48 pm
[...] gibt es auch einfachere Varianten, etwa hier. Aber auch hier wird noch einiges runtergeladen, kompiliert.. ach, Informatiker sind von Grund her [...]