Find it

Thursday, March 13, 2014

Apache-Subversion deployment - Legacy Solaris 8, different experience!

I got a requirement wherein customer requested to have Apache Subversion setup to be configured on quite old legacy version, Solaris 8 server; hence getting binaries for SVN on Solaris 8 is almost impossible hence I eventually decided to compile and install Subversion & all it's dependent components using source code.

Installing Subversion needs to fulfil some dependencies, below are the required dependent packages to install SVN successfully.

= Expat 2.x
= Apache 2.x with WebDAV support
= APR (Apache Portable Runtime)
= APR-UTIL
= NEON
= Compilation of SQLite-amalgamation C source code for SQLite which is a requirement for Subversion configure script and compilation purpose
= Compilation of zlib

This write-up is quite basic and gives enough insights on what compile string works fine on Solaris 8 and one might save lots of time.. trust me it's a pain to get Subversion compliled on Solaris 8 along with Apache and it's all dependent components.

Compile Expat
=============


# cd expat-2.0.1
#./configure && make && make install
# cd..

Compliling Apache 2.x
=====================


#./configure --prefix=/usr/local/apache2 --enable-so \
--enable-mods-shared=most --enable-ssl=static \
--with-ssl=/usr/local/ssl --enable-dav --enable-dav-fs
# make && make install
# cd..

Starting Apache Webserver
-------------------------


#/usr/local/apache2/bin/apachectl start

root@XXXX # ps -eaf | grep httpd | grep -v grep
  root 24948    1  2 21:35:49 ?        0:02 /usr/local/apache2/bin/httpd -k start
  svn 24952 24948  0 21:35:51 ?        0:00 /usr/local/apache2/bin/httpd -k start
  svn 24949 24948  0 21:35:51 ?        0:00 /usr/local/apache2/bin/httpd -k start
  svn 24950 24948  0 21:35:51 ?        0:00 /usr/local/apache2/bin/httpd -k start
  svn 24951 24948  0 21:35:51 ?        0:00 /usr/local/apache2/bin/httpd -k start
  svn 24953 24948  0 21:35:51 ?        0:00 /usr/local/apache2/bin/httpd -k start


Apache processes are onwed by user svn, you may use any user for this purpose.

Compile APR
===========


# cd subversion-1.6.6
# cd apr
# ./configure --prefix=/usr/local/apr
# make
# make install
# cd ..


Compile APR-UTIL
================


# cd apr-util
# ./configure --prefix=/usr/local/apr --with-apr=/usr/local/apr
# make
# make install
# cd ..


Compile NEON
============


# cd neon
# ./configure --prefix=/usr/local/neon  --with-ssl --with-libs=/usr/local/ssl --enable-shared
# make
# make install
# cd ..


Compile Subversion
==============


# ./configure --prefix=/usr/local/subversion \
--with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr --with-neon=/usr/local/neon
# make
# make install


If everything success subversion will add 2 modules into your apache modules and added 2 module line into your httpd.conf like below -

# more /usr/local/apache2/conf/httpd.conf
....
LoadModule dav_svn_module /usr/lib/apache2/mod_dav_svn.so
LoadModule authz_svn_module /usr/lib/apache2/mod_authz_svn.so
...

Restart Your Apache Services
----------------------------
------------

# /usr/local/apache2/bin/apachectl stop
# /usr/local/apache2/bin/apachectl start


SVN repository configuration via WebDAV
---------------------------------------
----------------

Under HTTP configuration file "/usr/local/apache2/conf/httpd.conf" put below configuration -
 











---------------------------------------------------------------------

Add users for basic authentication
==========================


# /usr/local/apache2/bin/htpasswd /usr/local/svn/repos/authz njoshi01
New password:
Re-type new password:
Adding password for user njoshi01


The above command can be used for adding user and modifying the password. Now to access the SVN repository user needs to authenticate and then access the repository contents.

--------------------------------------------------

To make sure the httpd service comes online automatically after server reboot will have to create startup script. Let's create a startup script -

-rwxr--r--   6 root     sys          734 Feb 13 10:24 /etc/init.d/apache

#!/sbin/sh

APACHE_HOME=/usr/local/apache2
CONF_FILE=/usr/local/apache2/conf/httpd.conf
RUNDIR=/var/run
PIDFILE=${RUNDIR}/httpd.pid

if [ ! -f ${CONF_FILE} ]; then
        exit 0
fi

if [ ! -d ${RUNDIR} ]; then
        /usr/bin/mkdir -p -m 755 ${RUNDIR}
fi

case "$1" in
start)
        /bin/rm -f ${PIDFILE}
        cmdtext="starting"
        ;;
restart)
        cmdtext="restarting"
        ;;
stop)
        cmdtext="stopping"
        ;;
*)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
esac

echo "httpd $cmdtext."

/bin/sh -c "${APACHE_HOME}/bin/apachectl $1" 2>&1
status=$?

if [ $status != 0 ]; then
        echo "exit status $status"
        exit 1
fi
exit 0


PS: For Solaris 10 you have to create SMF service. Creating SMF is not described in this write-up.

--------------------------------------------------

How developers access the SVN repository?
=================================

Either via Eclipse or Web based Subversion portal.
































I hope above notes will stand helpful..