Blog, Development, GNU/Linux, IT Security

ChiliProject 1.4.0 + Ruby Enterprise + Passenger + Apache2

I was a happy Trac user, but after seeing Redmine, I realized that Trac has many missing features and that you must do a lot of things with plugins, Redmine has this features out-of-box. After working a bit with Redmine I discovered ChiliProject, which is a fork of Redmine, and its actually compatible with Redmine Themes and Plugins.

Here is a comparison of Redmine/ChiliProject and Trac features:
Continue reading

Blog, GNU/Linux, IT Security

Installing TRAC with mod_wsgi using virtualenv

This guide is for installing Trac as a user using virtualenv for a isolated Python environment so that the whole installation runs under a specific user.

First of all we need to install needed packages

apt-get install libapache2-mod-wsgi python-virtualenv python-setuptools

Once we have installed the required packages proceed to create the Python environment

mkdir /usr/local/trac
cd /usr/local/trac
virtualenv python

We now have the isolated Python environment locate under /usr/local/trac/python.

To make possible to use easy_install with repositories we need to upgrade easy_install. I use this to install Trac plugins directly from SVN.

/usr/local/trac/python/bin/easy_install -U trunk

We now can install trac 0.12 using the 0.12b1 SVN Tag (http://svn.edgewall.com/repos/trac/tags/trac-0.12b1 or Trac==0.12b1) or directly from SVN Trunk:

/usr/local/trac/python/bin/easy_install http://svn.edgewall.org/repos/trac/trunk

This will download and install the latest trunk version for Trac.

To have webaccess to the Trac projects, we need a .wsgi script, were we define where our local python environment is located:

# Not needed if mod_wsgi >= 3.0
import sys
sys.stdout = sys.stderr

# Load Trac
import trac.web.main
application = trac.web.main.dispatch_request

And finally we need to configure apache. If you want only one Trac project, you should define trac.env to the location of your trac, but if you want multiproject support, you must use trac.env_parent_dir (this is what I used)


    ServerName trac.dns.com

    DocumentRoot /usr/local/trac/htdocs
    ErrorLog /var/log/apache2/trac-error.log
    CustomLog /var/log/apache2/trac-access.log combined

    # Trac Auth
    
        AuthType Basic
        AuthName "Trac"
        AuthUserFile /usr/local/trac/.htpasswd
        Require valid-user
    < /location>

    #Trac
    #Define ProcessGroup with user and group under which it should run
    WSGIDaemonProcess trac user=trac group=trac python-path=/usr/local/trac/python/lib/python2.5/site-packages python-eggs=/usr/local/trac/python/cache
    WSGIScriptAlias / /usr/local/trac/htdocs/trac.wsgi

    
        WSGIProcessGroup trac
        WSGIApplicationGroup %{GLOBAL}
        SetEnv trac.env_parent_dir /usr/local/trac/projects
    

We need to create the user and change the permissions for /usr/local/trac for that user trac

adduser --home /usr/local/trac --shell /bin/false --no-create-home trac
chown -R trac:trac /usr/local/trac

If you get an error “ImportError: No module named simplejson” just install it using easy_install

/usr/local/trac/python/bin/easy_install simplejson
Blog, MacOSX

Recompilar MAMP

El soporte de LDAP en MAMP 1.7.1 esta roto asi que tube que recompilar el PHP, lo cual me obligo a recompilar todas sus dependencias, pero como no encontre ninguna guia de como realizarlo correctamente, aqui esta como lo hice yo.

Lo primero es descargarse el codigo fuente proporcionado por la gente de MAMP, y su version compilada.

Codigo fuente: MAMP 1.7.1 (src)

Version Intel: MAMP 1.7.1 (intel)

Version PPC: MAMP 1.7.1 (ppc)

Una vez que tengamos esto, hay que instalar MAMP la version compilada en /Applications y asi ya tenemos toda la estructura correcta lista para solo recompilar lo necesario.

Ahora descomprimimos el codigo fuente y vamos compilando las diferentes librerias:

CURL

tar zxvf curl-7.16.2.tar.gz
cd curl-7.16.2
./configure --prefix=/Applications/MAMP/Library
make
make install

Freetype

tar zxvf freetype-2.3.4.tar.gz
cd freetype-2.3.4
./configure --enable-shared --configure=/Applications/MAMP/Library/
make
make install

Gettext

tar zxvf gettext-0.16.1.tar.gz
cd gettext-0.16.1
./configure --prefix=/Applications/MAMP/Library
make
make install

IMAP (Parche para osx: imap-2006i-osx.patch)

tar zxvf imap-2006i.tar.Z
cd imap-2006i
patch -p1 < imap-2006i-osx.patch
make oxp
cp c-client/*.h /Applications/MAMP/Library/lib/imap-2006i/include/
cp c-client/*.c /Applications/MAMP/Library/lib/imap-2006i/lib/
cp c-client/c-client.a /Applications/MAMP/Library/lib/imap-2006i/lib/libc-client.a

JPEG

tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --enable-shared --prefix=/Applications/MAMP/Library
ln -s `which glibtool` ./libtool
make
make install

libiconv

tar zxvf libiconv-1.11.tar.gz
cd libiconv-1.11
./configure --enable-shared --prefix=/Applications/MAMP/Library
make
make install

LibIdn

tar xvfz libidn-0.6.14.tar.gz
cd libidn-0.6.14
./configure --enable-shared --prefix=/Applications/MAMP/Library/
make
make install

libmcrypt

tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --enable-shared --prefix=/Applications/MAMP/Library/
make
make install

libpng

tar zxvf libpng-1.2.18.tar.gz
cd libpng-1.2.18
./configure --enable-shared --prefix=/Applications/MAMP/Library
make
make install

libxml

tar zxvf libxml2-2.6.29.tar.gz
cd libxml2-2.6.29
./configure --enable-shared --prefix=/Applications/MAMP/Library
make
make install

libxst

tar zxvf libxslt-1.1.21.tar.gz
cd libxslt-1.1.21
./configure --enable-shared --prefix=/Applications/MAMP/Library/ --with-libxml-prefix=/Applications/MAMP/Library/
make
make install

t1lib

tar zxvf t1lib-5.1.1.tar.gz
cd t1lib-5.1.1
./configure --enable-shared --prefix=/Applications/MAMP/Library/
make without_doc
make install

libexpat

Esta libreria es necesaria y no esta incluida, asi que hay que bajarla de http://sourceforge.net/projects/expat/

tar zxvf expat-2.0.1.tar.gz
cd expat-2.0.1
./configure --enable-shared --prefix=/Applications/MAMP/Library/
make
make install

MySQL

tar xvfz mysql-5.0.41.tar.gz
cd mysql-5.0.41
./configure --prefix=/Applications/MAMP/Library --with-unix-socket-path=/Applications/MAMP/tmp/mysql/mysql.sock --with-tcp-port=9999 --localstatedir=/Applications/MAMP/db/mysql/
make
make install

Apache2

tar zxvf httpd-2.0.59.tar.gz
cd httpd-2.0.59
./configure --prefix=/Applications/MAMP/Library --sysconfdir=/Applications/MAMP/conf/apache --enable-nonportable-atomics --enable-so --enable-cgid --enable-auth-anon --enable-auth-dbm --enable-auth-digest --enable-file-cache --enable-echo --enable-charset-lite --enable-cache --enable-disk-cache --enable-mem-cache --enable-example --enable-ext-filter --enable-case-filter --enable-case-filter-in --enable-deflate --enable-mime-magic --enable-cern-meta --enable-expires --enable-headers --enable-usertrack --enable-unique-id --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-http --enable-bucketeer --enable-http --enable-info --enable-cgid --enable-vhost-alias --enable-speling --enable-rewrite --enable-so --with-ssl=/usr --enable-dav --enable-dav-fs --enable-ssl=shared --enable-mods-shared=most --with-mpm=prefork --without-berkeley-db
make

Si al compilar nos aparece este error:

endrecv.c:965:2: error: #error APR has detected sendfile on your system, but nobody has written a
sendrecv.c:966:2: error: #error version of it for APR yet. To get past this, either write apr_sendfile
sendrecv.c:967:2: error: #error or change APR_HAS_SENDFILE in apr.h to 0.

Entonces tenemos que editar el fichero srclib/apr/include/apr.h y cambiar la linea #define APR_HAS_SENDFILE 1 por #define APR_HAS_SENDFILE 0

Y finalmente para instalar

make install

PHP

tar zxvf php-5.2.5.tar.gz
cd php-5.2.5
./configure --with-mysql=/Applications/MAMP/Library --with-apxs2=/Applications/MAMP/Library/bin/apxs --with-gd --with-jpeg-dir=/Applications/MAMP/Library --with-png-dir=/Applications/MAMP/Library --with-zlib --with-freetype-dir=/Applications/MAMP/Library --prefix=/Applications/MAMP/bin/php5 --exec-prefix=/Applications/MAMP/bin/php5 --sysconfdir=/Applications/MAMP/conf/php5 --with-soap --with-config-file-path=/Applications/MAMP/conf/php5 --enable-track-vars --enable-bcmath --enable-ftp --enable-gd-native-ttf --with-bz2=/usr --with-ldap --with-mysqli=/Applications/MAMP/Library/bin/mysql_config --with-sqlite --with-ttf --with-t1lib=/Applications/MAMP/Library --enable-mbstring=all --with-curl=/Applications/MAMP/Library --enable-dbx --enable-sockets --enable-bcmath --with-imap=shared,/Applications/MAMP/Library/lib/imap-2006i --enable-soap --with-kerberos --enable-calendar --with-pgsql=shared,/Applications/MAMP/Library/pg --enable-dbase --enable-exif --with-libxml-dir=/Applications/MAMP/Library --with-gettext=shared,/Applications/MAMP/Library --with-xsl=/Applications/MAMP/Library --with-pdo-mysql=shared,/Applications/MAMP/Library --with-pdo-pgsql=shared,/Applications/MAMP/Library/pg --with-mcrypt=shared,/Applications/MAMP/Library --with-openssl --with-iconv=shared,/Applications/MAMP/Library
make
make test
make install

Y con esto ya tenemos recompilado el MAMP y listos para funcionar. En cualquiera de las opciones se puede aprovechar para cambiar opciones, añadir o quitar modules, etc…