Sometimes the default compile and install is not actually what you want. For instance, you may not want to compile the server with all of the possible features, even if the prerequisites are installed; or you may want to install to somewhere other than/usr/local/. In these instances, the Subversion configure script provides several options that you can set when it is run. I explain the ones you are most likely to run into in the following. If you would like to see the complete list, you can run./configure help. To configure the Subversion compilation with one of these options, you should run the configure script with the desired option passed as a command-line parameter.
--prefix=PREFIX
The prefix option specifies where Subversion should be installed. By default, this is in
/usr/local/. If you would rather install Subversion somewhere else, passconfigurethe
--prefixoption, withPREFIXreplaced by the path where you would like Subversion to be installed. For example, if you are installing SVN on a system where you don’t have root privileges, you can run./configure prefix=$HOME/subversionto have Subversion installed in a directory namedsubversionin your home directory.
--with-apache=PATH --without-apache
These options tell the build scripts whether they should compile the Subversion server with support for Apache and WebDAV. The default behavior is for Apache to be included, but if for some reason you don’t want Apache support to be compiled, passing--without- apachetoconfigurewill disable it. Additionally, if Apache is installed in a nonstandard place on your system, you may have to tellconfigurewhere to find it. You can do that by passing the--with-apacheoption, withPATHreplaced by the path to where Apache is installed.
3.2 Installing on Mac OS X 29
--with-berkeley-db=PATH --without-berkeley-db
These options tell the build scripts whether they should compile the Subversion server with support for the Berkeley DB. The default behavior is for BDB to be included, but if you plan on using the filesystem-based repository storage,--without-berkeley-db
will disable BDB (of course, you can still use the filesystem repository even if BDB sup- port is compiled). Also, if Berkeley DB is installed in a nonstandard place on your sys- tem, you may have to tellconfigurewhere to find it. You can do that by passing the- -with-berkeley-dboption, withPATHreplaced by the path to where BDB is installed.
--disable-mod-activation
By default, Subversion modifies your Apachehttpd.conffile to enable the Subver- sion WebDAV module,mod_dav_svn, when you runmake install. If you don’t want it to make this modification, you can pass--disable-mod-activationto the configure script.
3.2
Installing on Mac OS X
Like Linux, Apple’s Mac OS X is a UNIX-like operating system. It was originally based on the open source FreeBSD operating system, which was itself derived from the University of California, Berkeley-developed BSD UNIX. On top of the UNIX underpinnings, Apple has built its own excellent graphical user interface. Regardless of whether you prefer to deal with OS X using the GUI or from under the hood at the command line, you have options for installing Subversion that should meet your needs.
3.2.1
Installing OS X Binaries
Installing the Subversion client on OS X is trivial. The Subversion Web site provides a link to prepackaged binaries of Subversion. To install, all you need to do is download the Subversion disk image (.dmg), mount it, and then launch the installer package (.pkg
extension). The installer will take you through a typical OS X install process that will set up everything to allow you to run Subversion from the command line, usingTerminal.app
or another terminal emulator.
3.2.2
Compiling Subversion on OS X
Compiling Subversion by hand on OS X should be as simple as compilation on Linux, and should follow the same process. Before installing, though, you may need to in- stall the Apple Developer Tools, which are available for free from Apple’s developer site (developer.apple.com). Installing the developer tools will install the GCC compiler, as well as a number of other development utilities, such as GNU Make.
“svnbook” — 2005/4/14 — 14:55 — page 30 — #51
i i
30 Chapter 3 Installing Subversion
3.2.3
Using Fink
An alternate way to install Subversion for OS X is through the Fink package management system. Fink provides a reasonably easy way for many open source packages (mostly from the UNIX world) to be installed. If you don’t have Fink installed already, you can get it fromfink.sourceforge.net. When Fink is installed, you can install Subversion from the command line.
To install the SVN client from the command line, open Terminal.app, and run sudo fink install svn-client. Additionally, you can install several other packages if you would like to get different versions of the Subversion server. Installing thesvnpackage, for instance, will get you the standalonesvnserveSubversion server, whereas the pack- agelibapache2-mod-svnwill get you everything you need to serve the repository over WebDAV, via Apache. If you would like the Subversion documentation, you can install the
svn-docpackage.
3.3
Installing on Windows
Installing Subversion on Windows is easy to do. If you follow the links for Win32 on the SVN download page, subversion.tigris.org/project_packages.html, you will find a Windows installer program, which should be named something like
svn-1.1.0-setup.exe. You can download the setup program and run it to install Sub- version. It will step you through everything you need to do to install SVN and get the basic application set up (see Figure 3.1).
If you plan to set up your Windows machine to serve a Subversion repository through Apache, I suggest that you run the Subversion installer after installing Apache. If you do so,
3.4 Configuring SVN to Use Apache 31
the Subversion installer will give you the option of allowing it to automatically configure Apache to load the appropriate modules for Subversion and WebDAV. You can also re-run the Subversion installer at a later date, if you install Apache and want to configure it for Subversion.
When installing Subversion on a Windows 2000 or XP machine, you should be able to install Subversion just by running the installer program. On the other hand, if you are installing on Windows 95, 98, or Millenium Edition, you may need to modify your
Autoexec.bat file to properly configure the system environment for Subversion. For example, if you installed inC:\Program Files\Subversion(the default location), you should set up yourAutoexec.batfile as follows.
1. Make sure that the%PATH%environment variable points to the directory that contains the Subversion binaries, like this:
SET PATH=C:\WINDOWS;C:\;C:\PROGRA~1\SUBVER~1\BIN
2. Set theAPR_ICONV_PATHenvironment variable.
SET APR_ICONV_PATH="C:\Program Files\Subversion\iconv"
3. Reboot your computer.
Subversion can also be compiled from source on Windows with Visual Studio, using the Windows-specific source, available as a zip compressed download (from the same place as thegzipandbzip2source downloads). The specific instructions for compiling under Windows, though, are beyond the scope of this book. If you are interested in compiling the Windows version, theINSTALLfile included with the Subversion source contains detailed step-by-step information about the process.
3.4
Configuring SVN to Use Apache
If you plan to use the Subversion WebDAV extensions for remote access to your repository, you have to set up Apache to load the SVN WebDAV module and tell it where to find your repository. Also, make sure that Apache has read/write access to any repositories that you want it to serve.
3.4.1
Loading the Modules
The first step is to make sure that Apache is set up to load themod_davandmod_dav_svn
modules (mod_davis not compiled in Apache by default so you may have to compile it yourself; most distributions of Apache do have it compiled already though). Subversion’s
make installcommand should have done this for you, but it’s a good idea to take a quick look to make sure everything seems correct. TheLoadModuledirective for the SVN DAV module should be in yourhttpd.conffile. The location of thehttpd.conffile is very system specific, and depends a lot on how Apache was installed on your particular sys- tem. In general, though, you will probably find it either in/usr/local/apache2/conf
“svnbook” — 2005/4/14 — 14:55 — page 32 — #53
i i
32 Chapter 3 Installing Subversion
or somewhere under the/etcdirectory on most UNIX-based systems. If you are installing under Windows, thehttpd.conffile should be in the directory where Apache is installed (which is probably C:\Program Files\Apache Group\Apache2\conf). If you have both Apache 1 and Apache 2 installed on your system, make sure that the httpd.conf
file you are checking is the configuration file for Apache 2.
After you have found thehttpd.conffile, you should check it for theLoadModule
directives formod_dav_svnandmod_dav, which should look something like this:
LoadModule dav_module modules/mod_dav.so LoadModule dav_svn_module modules/mod_dav_svn.so
There may be otherLoadModuledirectives betweenmod_davandmod_dav_svn, but it is important to make sure thatmod_davis loaded beforemod_dav_svn. On some systems,
mod_davmay have been statically compiled into Apache, in which case there is no need to have aLoadModuledirective for it.
3.4.2
Setting Up Access
In order to allow people to access your repository through Apache, you need to set up a
Locationdirective to tell Apache where to find the repository, as well as what URL path to use. TheLocationdirective will also go in yourhttpd.conffile, and should be added to the end of the file, to ensure that everything has been loaded properly before it is processed.
A basicLocationdirective for your repository will look something like this:
<Location /repos> DAV svn SVNPath /srv/subversion/repos AuthType Basic AuthName "Subversion" AuthUserFile /srv/subversion/svn_passwd Require valid-user </Location>
Let’s look at what each line in the preceding directive means.
The first line opens the Location directive. The path given after Location tells Apache what the URL path to the repository should be. For example, in the preceding sample directive, if your Web site were at www.example.com, the URL for the repository would behttp://www.example.com/repos. TheLocationdirective is then closed by the</Location>tag on the last line.
The second line of the directive tells Apache that the location you are setting up points to a WebDAV share, which should use the SVN extensions. That is followed by the third line, which tells Apache where to find the Subversion repository, which should give an absolute path to the directory that was created when svnadmin create made your repository.
3.4 Configuring SVN to Use Apache 33
The next four lines set up the security policies for the repository. AuthType Basic
informs Apache that you want simple password protection, and AuthNameis the name that should be used when requesting the password. TheAuthUserFilegives the file that contains the valid users and their passwords. Finally,Require valid-userspecifies that a valid authorization should be required for all operations on the repository. For a more detailed discussion on securing your WebDAV share, see Chapter 10, “Administrating the Repository.”