Tuesday, October 16, 2007

Installing SVN 1.4 in a Nexenta Zone

Nexenta already provides a package for installing Subversion, but it is SVN 1.3. My goal in this posting is to install SVN 1.4 (the latest is 1.4.5) with Apache in a new Zone. I prefer to use a new Zone because it helps me determine all dependencies that I need to install alongside the primary package I am installing, it will keep my Subversion install free from any side effects of other programs, and a new Zone will look like a different computer with its own ip address on my network.

Step 1: Create a Subversion Zone


See these instructions for setting up a new zone for Nexenta. I named my zone svn_zone and put it in /export/home/zones/svn_zone.
While the Nexenta zones tutorial gives you a shortcut for installing apache2 along with the base zone install, I do NOT recommend this, as my install hung Configuring apache2 when I originally tried. In any case, it is no big deal installing the base zone first and then explicitly installing the apache2 package.

Step 2: Setup the Subversion Dependencies


  • root@svn_zone:~# apt-get install apache2
  • root@svn_zone:~# apt-get install apache2-dev (for apr-util)
  • root@svn_zone:~# apt-get install libneon25 (for ra WebDAV support)
  • root@svn_zone:~# apt-get install libneon25-dev (for neon-config)
  • root@svn_zone:~# apt-get install gcc
  • root@svn_zone:~# apt-get install make
  • root@svn_zone:~# apt-get install python (we will use this for running make check)

Step 3: Install Subversion 1.4



Download the SVN source code
  • copy subversion-1.4.5.tar into /usr/opt and untar it
  • root@svn_zone:~# cd /usr/opt/subversion-1.4.5
  • root@svn_zone:/usr/opt/subversion-1.4.5~# ./configure
  • root@svn_zone:/usr/opt/subversion-1.4.5~# make
  • root@svn_zone:/usr/opt/subversion-1.4.5~# make install
  • root@svn_zone:/usr/opt/subversion-1.4.5~# make check

Step 4: Create a New Repository



This post helped with some of the following instructions.
  • root@svn_zone:~# mkdir /usr/local/svn_repository
  • root@svn_zone:~# svnadmin create /usr/local/svn_repository
  • root@svn_zone:~# chown -R nobody /usr/local/svn_repository (apache2 runs as 'nobody')

Step 5: Setup Apache for Basic Authentication


  • root@svn_zone:~# htpasswd -cm /usr/local/svn_repository/conf/svn_users svn_admin (this sets up a users file with the user svn_admin and will prompt you for a password)
  • root@svn_zone:~# vi /etc/apache2/httpd.conf
The httpd.conf file should already contain the following two lines
LoadModule dav_svn_module /usr/lib/apache2/modules/mod_dav_svn.so
LoadModule authz_svn_module /usr/lib/apache2/modules/mod_authz_svn.so

Before those two lines add another line to explicitly make sure the dav_module is loaded; otherwise you will get an error similar to this:
Cannot load /usr/lib/apache2/modules/mod_dav_svn.so into server: ld.so.1: apache2: fatal: relocation error: file /usr/lib/apache2/modules/mod_dav_svn.so: symbol dav_xml_get_cdata: referenced symbol not found.

LoadModule dav_module /usr/lib/apache2/modules/mod_dav.so

Add the following section to the end of httpd.conf:
<Location /svn>
DAV svn
SVNPath /usr/local/svn_repository
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /usr/local/svn_repository/conf/svn_users
Require valid-user
</Location>

# restart apache2
  • root@svn_zone:~# apache2 -k restart

Now try to open http://192.168.0.110/svn in your browser from the root Zone. You should be prompted for a username and password and then you will be brought to a screen with this information:

Revision 0: /
Powered by Subversion version 1.4.5 (r25188).

You now have a Zone dedicated to running Subversion 1.4.5 with Apache using Basic Authentication!

No comments: