Friday, June 06, 2008

Setting up Apache and SVN on Suse Linux 10

Installation

Firstly, lets say that you already have a C compiler. If not, please install that first.

My main reference : http://www.komaii.com/linux/apache2-ssl-subversion-trac-on-SuSE10.0/

To use a different installation path, use

$ wget http://apache.oss.eznetsols.org/httpd/httpd-2.2.6.tar.gz
$ tar -zxvf httpd-2.2.6.tar.gz
$ ./configure --prefix=/path/to/install

The full arguments for ./configure can be referenced from my main reference link above.

$ make
$ make install

Usually I would do a make check, but httpd-2.2.6.tar.gz does not come with test scripts. If I am wrong, someone correct me.

Then you set the environment variables so the $PATH contains the httpd/bin directory. This is useful if you want to run the apachectl script to start and stop the HTTP server.

$ apachectl start
$ apachectl stop

But do run the server yet, you got one more config file to modify; the httpd.conf file. If you are lazy like me, or you do not have root access to the server to create a new user and user group to run the server (creates a more secure environment, according to countless sites that you can actually google it), you can directly set

User mark
Group mark

Then you set the rest of the stuff

ServerName localhost
Listen 80

Then start your HTTP server. It should run nicely. Now you are all set to install SVN.

$ wget http://subversion.tigris.org/downloads/subversion-1.4.6.tar.bz2
$ bunzip2 subversion-1.4.6.tar.bz2
$ tar -xvf subversion-1.4.6.tar
$ cd subversion-1.4.6
$ ./configure --prefix=/path/to/install

Please also refer to the main reference I used for the complete configure arguments

$ make
$ make check

make check will take a very very long time.

$ make install


Then its all done. Just a reminder to myself. SVN requires APR (Apache Portable Runtime) which you can actually download separately and attach the source files in a subfolder under subversion-1.4.6/apr and apr-utils. If you are like me and tried to install SVN without having a HTTP server in your Linux, or you did not point your --with-apr and --with-apr-util to the correct httpd folder, you will be notified with a warning message. The parameters should look like

--with-apr=/path/to/httpd
--with-apr-util=/path/to/httpd

I tried with no luck on using the APR on their own. What worked was installing the HTTP server and using that as the source of APR files.

After all this, you set the $PATH for svn which should point to svn/bin.

After you install SVN, the modules required for httpd,

mod_dav_svn.so
mod_authz_svn.so

to run svn will magically appear in the httpd/modules folder. Make sure they also are in the httpd.conf file.

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

Basic Security

I constructed a basic authentication box using apache's htpasswd. I stored the file outside of the htdocs folder, naming it svn-auth-file which contents look like:

mark:htidkl13hadsfA:

In httpd.conf, I added this.

<location>
DAV svn
SVNPath /path/to/httpd/htdocs/data/project
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /path/to/httpd/svn-auth-file
Require valid-user
</location>