Friday, March 16, 2012

Install Apache + mod_svn_dev + SVN + user-friendly-svn on QNAP

The ipkg for QNAP can only install Apache web server & SVN server seperately, there is no way to load mod_svn_dav in order to obtain a web interface management system such as user-friendly-svn or svnmanager to work.

My soluction is recomplile Apache2, PHP5.4, Subversion 1.6.17, here is something you need to do before the compilation.

ipkg install grepipkg install sedipkg install gccipkg install binutilsipkg install makeipkg install autoconfipkg install automakeipkg install diffutilsipkg install m4ipkg install libxml2ipkg install fileipkg install perlipkg install libdbipkg install gawk

By default the QNAP uses the grep, sed, awk from busybox which is a bit out of date, so we installed their latest version from the ipkg, then you will need to update the link in /bin

mv /bin/awk /bin/awk_bakln -s /opt/bin/awkmv /bin/grep /bin/grep_bakln -s /opt/bin/grepmv /bin/sed /bin/sed_bakln -s /opt/bin/sed

NOTE: if you use ipkg install linuxutils again, you will re-do the link as the installation will roll back those command to busybox again.

Download icu-config, it is reuqired by php

wget xfvz icu4c-4_8_1_1-src.tgz./configure --prefix=/path_to_you_preferredmake && make install

Change the working directory to source code for apache2
configure with

./configure --prefix /path_to_you_preferred --enable-authz-host --enable-proxy --enable-proxy-http --enable-so --enable-rewrite --enable-vhost-alias  --enable-modules --enable-dav --enable-so --enable-dav=shared --enable-dav-fs=shared make && make install

Change the working directory to source code for subversion1.6.17

./configure --prefix=/path_to_you_preferred --with-apxs=/YOUR_APACHE_DIRECTORY/bin/apxs --with-apr=/YOUR_APACHE_DIRECTORY/bin/apr-1-config --with-apr-util=/YOUR_APACHE_DIRECTORY/bin/apu-1-config --with-berkeley-db=/opt/libmake & make install

Trouble shooting:
If you experienced with undefined symbol: REP_CACHE_DB_SQL
Then vi subversion/libsvn_fs_fs/rep-cache-db.h alter REP-CACHE-DB_SQL to REP_CACHE_DB_SQL.
This bug was something wrong when generate rep-cache-db.h

Change the working directory to source code for PHP5.4


./configure --prefix=/path_to_you_preferred --with-icu-dir=/YOUR_ICU_DIRECTORY/icu4 --with-apxs2=/share/YOUR_APACHE_DIRECTORY/bin/apxs --with-mysql=/mnt/ext/opt/mysql --with-pdo-mysql=/mnt/ext/opt/mysql --libdir=/share/MD0_DATA/.qpkg/Optware/lib --includedir=/share/MD0_DATA/.qpkg/Optware/includemake && make installvi /YOUR_APACHE_DIRECTORY/conf/httpd.conf

Make sure you have following modules loaded

LoadModule dav_module     modules/mod_dav.soLoadModule dav_svn_module     modules/mod_dav_svn.soLoadModule authz_svn_module   modules/mod_authz_svn.soLoadModule php5_module        modules/

AddType application/x-httpd-php-custom .php

    SetHandler application/x-httpd-php

change your user group to in httpd.conf

create an alias for usvn

Alias /usvn /USVN_FOLDER/public    Options +SymLinksIfOwnerMatch    AllowOverride All    Order allow,deny    Allow from all

Follow the installation guide usvn to complete the installation.