Friday, November 27, 2009

Install Subversion on SunOS 5.10 (Solaris 10)

Hi there,

So this is the story, although I already have a running svn server using VisualSvn on my office station (a wind*z machine), still I couldn't help worried bout something bad might happen to my precious. So I asked my boss whether or not I could use any *nix compliant machine in our network to serve as a Versioning server and get rid of the paranoia. And he gave me one, great !

One little problem, how would I do that ? Did a lot on Linux, few on windows, but on Solaris this would be the first time, hurraaay!!

I'm not sure whether direct linking from my post to sunfreeware packages is allowed or not, so download all the required package from here (all package from step 1 - 14). Most of the text below were retrieved from sunfreeware, wrap it, and added some comment. The idea is when you already download all the software required below, you only need to look at this post till you finish installing svn(hopefully).

to install a .gz package file do the following (assume the .gz file is in /tmp and you are root)

~# cd /tmp
~# gunzip <downloaded_package>.gz
~# pkgadd -d <downloaded_package>

Now I've been spending all night figuring how to install a working subversion (server) to a solaris system, and this is what I've got.

machine :

SunOS 5.10 Generic_125100-09 sun4u sparc SUNW,Sun-Fire-V890.


steps :

You need a root privilege to install packages below, make sure you follow below steps in order, I've arrange these steps based on subversion dependency tree. You might wanna backup the whole /usr/local directory just in case. Now let's begin the journey...
  1. install libgcc-3.4.6-sol10-sparc-local.gz

  2. This package includes the files and links
    libgcc_s.so
    libgcc_s.so.1
    libstdc++.so
    libstdc++.so.6
    libstdc++.so.6.0.3

    in my case my target system already have this library installed, so I skipped the first step.

  3. install openssl-0.9.8l-sol10-sparc-local.gz

  4. openssl is an open source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a full-strength general purpose cryptography library - installs in /usr/local/ssl.

  5. install expat-2.0.1-sol10-sparc-local.gz

  6. Expat is a fast, non-validating, stream-oriented XML parsing library - installs in /usr/local.

  7. install zlib-1.2.3-sol10-sparc-local.gz

  8. zlib compression libraries - installs in /usr/local. This package has both libz.a and libz.so libraries.

  9. install libiconv-1.11-sol10-sparc-local.gz

  10. GNU libiconv provides an iconv() implementation for use on systems which do not have one - installs in /usr/local.

  11. install db-4.2.52.NC-sol10-sparc-local.gz

  12. db is the Berkeley open source embedded database system - installs in /usr/local/BerkeleyDB.4.2.

  13. install sasl-2.1.21-sol10-sparc-local.gz

  14. This is the Cyrus SASL (Simple Authentication and Security Layer) API implementation. It can be used on the client or server side to provide authentication and authorization services - installs in /usr/local.
    The installation of the sasl software indicates:
    ********************************************************
    * WARNING:
    * Plugins are being installed into /usr/local/lib/sasl2,
    * but the library will look for them in /usr/lib/sasl2.
    * You need to make sure that the plugins will eventually
    * be in /usr/lib/sasl2 -- the easiest way is to make a
    * symbolic link from /usr/lib/sasl2 to /usr/local/lib/sasl2,
    * but this may not be appropriate for your site, so this
    * installation procedure won't do it for you.
    *
    * If you don't want to do this for some reason, you can
    * set the location where the library will look for plugins
    * by setting the environment variable SASL_PATH to the path
    * the library should use.
    ********************************************************

    I did the easiest way, create a symbolic link in /usr/lib to /usr/local/lib/sasl2

  15. install neon-0.25.5-sol10-sparc-local.gz

  16. Neon is an HTTP and WebDAV client library - installs in /usr/local. Neon is used by subversion.

  17. install apache_noldap-2.2.11-sol10-sparc-local.gz

  18. Apache 2 - the popular web server - installs in /usr/local/apache2. Documentation can be found in /usr/local/apache2/doc/apache2. The configuration files in /usr/local/apache2/conf must be edited to fit your site's needs, including ssl support.

    I dont want to setup my svn server with apache, yet the subversion package from sunfreeware required this package to be installed, you might change this requirement if you compile the subversion source (also from sunfreeware) without apache support.

  19. install swig-1.3.36-sol10-sparc-local.gz

  20. SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. SWIG is used with different types of languages including common scripting languages such as Perl, PHP, Python, Tcl, Ruby and PHP - installs in /usr/local.

  21. install libxml2-2.6.31-sol10-sparc-local.gz

  22. Libxml2 is the XML C library developed for the Gnome project - installs in /usr/local.

  23. install libintl-3.4.0-sol10-sparc-local.gz

  24. Libintl is used with gettext and is needed by a few programs when libintl in not in /usr/lib - installs in /usr/local/lib.

  25. install openldap-2.4.16-sol10-sparc-local.gz

  26. OpenLDAP is an open source implementation of the Lightweight Directory Access Protocol - installs in /usr/local.

    warning! this package giving me a hard time when I realized that one of my shared library wasnt update enough (libresolv.so.2), the workaround is at the end of this post.

  27. finally! subversion-1.6.5-sol10-sparc-local.gz

  28. Subversion is an alternative to the CVS version control system - installs in /usr/local.

ok when you're done, go to /usr/local/bin/ directory and type

~# ldd svn

you'll get something like
~# ldd svn
libsvn_client-1.so.0 => /usr/local/lib/libsvn_client-1.so.0
libsvn_wc-1.so.0 => /usr/local/lib/libsvn_wc-1.so.0
libsvn_ra-1.so.0 => /usr/local/lib/libsvn_ra-1.so.0
libsvn_diff-1.so.0 => /usr/local/lib/libsvn_diff-1.so.0
libsvn_ra_local-1.so.0 => /usr/local/lib/libsvn_ra_local-1.so.0
libsvn_repos-1.so.0 => /usr/local/lib/libsvn_repos-1.so.0
libsvn_fs-1.so.0 => /usr/local/lib/libsvn_fs-1.so.0
libsvn_fs_fs-1.so.0 => /usr/local/lib/libsvn_fs_fs-1.so.0
libsvn_fs_util-1.so.0 => /usr/local/lib/libsvn_fs_util-1.so.0
libsvn_ra_svn-1.so.0 => /usr/local/lib/libsvn_ra_svn-1.so.0
libsvn_ra_neon-1.so.0 => /usr/local/lib/libsvn_ra_neon-1.so.0
libsvn_ra_serf-1.so.0 => /usr/local/lib/libsvn_ra_serf-1.so.0
libserf-0.so.0 => /usr/local/lib/libserf-0.so.0
libm.so.2 => /usr/lib/libm.so.2
...
if theres a line that tells some file not found, that means there some package you've missed, check all the package in this post and makesure you've install them in order.
when everything is done, try to type

~# svn help

if it print the help page, then you're successfully install subversion on your Solaris 10, congratulations !!. But if you're like me and it didn't print the help page, instead showing this kind of error

ld.so.1: svn: fatal: libresolv.so.2: version `SUNW_2.2.2' not found (required by file /usr/local/lib/libldap-2.4.so.2)
ld.so.1: svn: fatal: libresolv.so.2: open failed: No such file or directory
Killed

that means the libldap-2.4.so.2 (from openldap package) require newer version of libresolv.so.2 which I couldn't get anywhere.

From sunfreeware :
you will need to update to a newer version of Solaris 10 or upgrade the SUNWcsl and SUNWcslr packages
Update system ? that's not an option for me, and I could'nt find any of the new packages. Googling whole night gives me some other options.
  1. recompile openldap from sources and create a mapfile to point to the existing libresolv.so.2 (or something like that)
  2. set the LD_NOVERSION environment variable to non null value, so that the linker will ignore any version check.

  3. ~# export LD_NOVERSION=1
I dont really get the first option, so I hit the second one, and it actually work flawless !. The problem is if we set the LD_NOVERSION environment variable, then the linker will ignore version checking of the existing shared library for all application which can break the whole system, so be careful! Everytime you have finished doing your svn thing, make sure to unset that variable again.

~# unset LD_NOVERSION

Ok, now lets setup the server, I'm not using Apache for that, instead I'm using svnserve (from subversion package), the advantage is, it's so easy to setup, the disadvantage is, you need an svn client to browse the repository, while for apache you could use plain web browser to browse a repository.
Create a new repository in /root directory with svnadmin

~# svnadmin create /root/repository

I've made a script called start_svnserver.sh to start the svn server as a daemon which consist following lines

#!/bin/bash
# ignore version check
export LD_NOVERSION=1
# start the server
svnserve -d -r /root/repository --pid-file svnserve.pid --log-file svnserve.log
# dont forget to unset this, we only need it to start svnserve
unset LD_NOVERSION

and stop_svnserver.sh to stop the svn_server, consist the following lines.

#!/bin/bash
cat svnserve.pid | xargs kill -15


make sure that stop_svnserver.sh is in the same directory of start_svnserver.sh, and command svnserve is accessible. After the server started, We can connect to the new server with any svn client for example using command-line svn, or an IDE (I'm using Eclipse+subclipse plugins).

the main repository url would be like

svn://<hostname_or_ip>


Good luck !

Keywords : subversion, Solaris10, libresolv.so.2, SUNW_2.2.2, mapfile openldap

2 comments:

ZeftSlayer said...

Hai,

Your post is very good....example on how to copy manual and put it to blog, as its your own....

Zeft said...

Hi,

@ZeftSlayer

Hi, which part of "Most of the text below were retrieved from sunfreeware, wrap it, and added some comment." that you didn't understand well ?

OK, so maybe you have a point, maybe I didn't make my disclaimer clear and formal enough, but I wont edit my post, Just wanna make sure from the beginning I post it, never (ever) did I claim most of those text were Mine.