Author |
Johannes Fahrenkrug |
Reviewer |
Joerg Kaminski |
Contact |
jfahrenkrug<N0 5PAM>.dot.gmail.dot.com |
Version |
1.7 |
Last Update |
10/27/2005 |
Contents
I Introduction/Notes
So you decided (or you have been told) to install Subversion. Then all you have to do now is lean back and enjoy the ride, because we did all the work for you already. This document will save you a hack of a lot of time (and it might even make you the employee of the month).
We didn’t feel like typing two different download URLs for all the Solaris 8 and 9 packages. Hence we only used the Solaris 8 paths. In most cases you only have to replace the 8 with a 9 in the FTP paths and package names.
Please note that this guide is about compiling and installing Subversion and all the programs that it depends on from source. In case your hand moves in the direction of your head and makes a scratching motion when you hear the word “compile”, this guide might not be for you. You can get pre-compiled packages for just about any OS by now. That is definitely the easier way to go.
The section about configuring and setting up the Subversion server might be interesting for you even if you don’t compile everything from source, though.
In case this document actually helps you, we’d be very grateful if you would nag your employer about some t-shirts, mugs and other free stuff for us. (Whoever is reading this and actually is considering sending us something: You’re the first one, man! More power to you!)
Anyway, have fun (and success) installing Subversion!
PS: I guess I have to say this: I am not responsible for any damage that might be caused by following this guide!
II Step by Step Installation
1. Create a directory for all the source files that you’ll have to download and compile in the next steps. I’ll call this directory /basedir
2. Go to http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=260 and download the newest Subversion source tarball (save it in /basedir).
3. Open a shell and become the superuser:
su -
4. Go to the basedir and unpack the Subversion source files:
gunzip subversion-1.2.3.tar.gz
tar -xvf subversion-1.2.3.tar
5. Change into the subversion-1.2.3 subdirectory and run the autogen.sh script:
cd subversion-1.2.3
./autogen.sh
6. The script checks if all of Subversion’s dependencies are installed. When the script coughs up this error message:
“Can’t locate object method “path” via package “Request” at
/usr/local/share/autoconf/Autom4te/C4che.pm line 69, <GEN1> chunk 111.”
the directory “autom4te.cache” in the subdirectory “expat” of Subversion has to be deleted:
rm -r /basedir/subversion-1.1.1/apr-util/xml/expat/autom4te.cache
When the script says that one of the following things is not installed or not recent enough, then please follow the next steps and run autogen.sh again to check if everything’s OK now. Of course you can also download and install the newest versions of these tools and libraries, even if the installed versions are sufficient.
In case the script says that everything’s fine (autoheader warnings can be ignored) continue with step 7. If the script complains:
a. autoconf/autoheader: Continue with Appendix A.
b. libtool: Continue with Appendix B.
c. m4: Continue with Appendix C.
d. Python: For Linux continue with Appendix D. For Solaris continue with Appendix E.
e. Libxml2: Continue with Appendix F.
f. neon lib: Doesn’t have to be downloaded because it comes with the Subversion source files.
7. Go to http://www.sleepycat.com/download/index.shtml
and download the newest source tarball of Berkeley DB (either with or without strong cryptography, it doesn’t matter). Save it in /basedir.
Note: |
Starting at version 1.1.0 Subversion doesn’t depend on Berkeley DB anymore because it comes with its own database backend called FSFS. I don’t have any experience with FSFS yet. Hence I describe the installation using Berkeley DB. As soon as I install Subversion again, I will use FSFS and add the description here.
|
8. Don’t forget to download available patches (I don’t think there are any for the current version).
9. Extract the Berkeley DB source files in the basedir:
gunzip db-4.3.29.tar.gz
tar -xvf db-4.3.29.tar
10. Copy patches - if there are any - that you have downloaded into the db-4.3.29 directory:
(This is just an example, there are not patches for version 4.3.29 of BerkeleyDB, as far as I know):
cp patch.4.3.29.1 db-4.3.29
cp patch.4.3.29.2 db-4.3.29
11. Change into the db-4.3.29 directory.
12. Patch the source files (if patches are available):
patch -p0 < patch.4.3.29.1
patch -p0 < patch.4.3.29.2
13. Change into the build_unix directory
14. Run the configure script:
../dist/configure
Under Solaris you may have to run the script like this:
env CC=gcc ../dist/configure
15. Run make:
make
16. Pass the time with an activity of your choice (flossing, maybe).
17. Run make install:
make install
18. Clean up…:
make clean
19. Make the Berkeley DB libraries known:
a. Under Linux: |
1. Change into the /etc directory
2. Add the following line to your ld.co.conf file:
/usr/local/BerkeleyDB.4.3/lib
3. Run ldconfig:
ldconfig
|
b. Under Solaris: |
1. Set the LD_RUN_PATH:
LD_RUN_PATH=/usr/local/BerkeleyDB.4.3/lib
2. Export the LD_RUN_PATH:
export LD_RUN_PATH
3. Set the LD_LIBRARY_PATH:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/BerkeleyDB.4.3/lib
4. Export the LD_LIBRARY_PATH:
export LD_LIBRARY_PATH
|
As an alternative to point b you can also add a symbolic link to a directory that already is in the LD_LIBRARY_PATH, for example:
cd /usr/local/lib
ln -s /usr/local/BerkeleyDB.4.3/lib/libdb-4.3.so libdb-4.3.so
|
20. Go to http://httpd.apache.org/download.cgi
and download the newest source tarball of the Apache2 httpd server. Save it in /basedir. Sometimes
the download fails if you use http. In that case, do this:
ftp ftp.uni-erlangen.de
cd /pub/mirrors/apache/httpd/
ls
Then find the newest tarball and download it, i.e.:
binary
mget httpd-2.0.55.tar.gz
y
bye
21. Extract the Apache source files in basedir:
gunzip httpd-2.0.55.tar.gz
tar -xvf httpd-2.0.55.tar
22. Change into the httpd-2.0.55 directory
23. Run buildconf:
./buildconf
autoheader warnings can be ignored.
24. Run configure:
./configure --enable-dav=shared --with-gdbm=no --enable-deflate=shared --enable-so --with-berkeley-db=/usr/local/BerkeleyDB.4.3 --with-dbm=db4
Hint: |
In certain cases it might be necessary to use --enable-dav and
--enable-deflate without "=shared" . Or it can help to use --enable-mod_deflate=shared instead of --enable-deflate=shared . |
25. When configure finished without errors, run make:
make
26. Make coffee…
27. Run make install:
make install
28. Clean up…:
make clean
29. Change into the /basedir/subversion-1.2.3 directory
|
30. Run configure:
./configure --with-berkeley-db=/usr/local/BerkeleyDB.4.3 --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apache2 --with-apr-util=/usr/local/apache2
In case BerkeleyDB.4.3 has been installed in it’s default directory, the configure script of Subversion version 1.0.2 and higher finds the BerkeleyDB libraries automatically. In that case, you can run configure without "--with-berkeley-db"
.
Watch out for any messages that say that only a Subversion client can be built. In that case, something went wrong.
Hint: |
If you encounter any problems under Solaris 8/9/10 (which might only occur as late as at the “make install” step),
it can be helpful to use config.nice instead of the configure script. Sometimes it also helps to reinstall Apache2. |
31. Run make:
ATTENTION: |
In case an earlier version of Subversion is already installed, you have to delete those Subversion and Neon libraries before you run make. This is what you have to do:
rm -f /usr/local/lib/libsvn*
rm -f /usr/local/lib/libneon* |
Now you can run make:
make
32. Maybe the coffee you made in step 26 causes a certain pressure inside of you….
Now would be the perfect opportunity to get some relief!
33. Run make install:
make install
34. Clean up:
make clean
35. Change into the directory /basedir/subversion-1.2.3/tools/xslt
36. Copy the contents of the directory into the Apache2 htdocs directory:
cp * /usr/local/apache2/htdocs
37. Create the group “svn”:
a. Under Linux: |
groupadd -r svn |
b. Under Solaris: |
groupadd svn |
38. Create the user “svn”:
a. Under Linux: |
useradd -r -g svn svn |
b. Under Solaris: |
useradd -g svn svn |
39. Set the password for the user “svn”:
passwd svn
40. Create the repository (you can change the path below to anything you like, but I will keep using it as an example path in this document). Execute this as root:
cd /usr/local
mkdir svnrepos
chown svn:svn svnrepos
ATTENTION: THE REPOSITORY MAY NOT RESIDE ON AN NFS DRIVE!
41. Create the repository as the user “svn”:
su svn
svnadmin create /usr/local/svnrepos
(If you get an error at this point saying thay some libs could not be found, set the LD_LIBRARY_PATH as described in section 19b and try again)
exit
42. Set up Apache. Change into the Apache2 conf directory:
cd /usr/local/apache2/conf
43. Fire up your favorite editor and open the httpd.conf file.
44. Make sure the file contains the following lines:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
There lines have to appear before any other statements that have to do with Subversion!
45. Find the line that starts with “Listen” and set its value to the port that Apache should listen on, i.e.:
Listen 7770
46. Finde the line that starts with “#ServerName” an set it to the name of your server:
ServerName subversion.yourdomain.com
47. Find the area that contains the <Location>
directives and add the following text to it (”/rep” being a virtual path of your choice under which the repository will be served and “/usr/local/svnrepos” being the absolute path of the repository):
<Location /rep>
DAV svn
SVNPath /usr/local/svnrepos
SVNIndexXSLT “/svnindex.xsl” # (optional, to make it pretty)
AuthType Basic
AuthName “Subversion repository”
AuthUserFile /etc/.svn-auth-file
Require valid-user
</Location>
Your repository can be found at http://subversion.yourdomain.com:7770/rep later.
If you plan to host more than one repository under one directory, you can use SVNParentPath instead of SVNPath . SVNParentPath is a normal directory, under which you can create as many repositories as your heart desires. That means that you would have to create repositories as described in section 41 INSIDE the SVNParentPath directory. That has the advantage that you don’t have to add another <Location> directive to the httpd.conf file for each new repository. Hence, you also wouldn’t have to restart Apache to make the new repository accessible. You could - for example - reach different repositories at http://subversion.yourdomain.com:7770/rep/repos1 and at http://subversion.yourdomain.com:7770/rep/repos under the SVNParentPath directory. If you use SVNParentPath and try to open http://subversion.yourdomain.com:7770/rep you’ll get an error message. That means that you always have to specify a repository.
|
ATTENTION: |
You have to make sure that the virtual path (in this case /rep) doesn’t interfere with other virtual paths of Apache. If - for example - your DocumentRoot is /www and you set /www/rep as the virtual Subversion path in the Location tag, you’ll have a problem: Apache wouldn’t be able to tell which directive to execute when /www/rep in requested: the directive of DocumentRoot or the one of Subversion? |
The Auth directives are important for access control. You can choose the path and filename for the AuthUserFile directive. You have to remember that path and the filename though because we have to create that file later, for the usernames and passwords.
48. Save and close the httpd.conf file.
49. Create the access control file for the users that should be allowed to use Subversion:
htpasswd -cm /etc/.svn-auth-file johannes
Repeat this with the option -m
instead of -cm
until all the users are created (replace “johannes” with the appropriate usernames, of course)
ATTENTION: |
It is important to use -m instead of -cm for all following users. Otherwise you’d overwrite the file each time. |
50. Change into the /usr/local/ directory
51. Make the user “svn” the owner of all Apache files and directories:
chown -R svn:svn apache2
52. Become the user svn:
su svn
53. Change into the /usr/local/apache2/bin directory
54. Fire up the Apache2 server:
./apachectl start
55. Open a web browser and go to
http://subversion.yourdomain.com:7770/rep
The page should display something like this:
Revision 0
/
Powered by Subversion 1.2.3
56. The Subversion server is now set up and ready to be used (congratulations)!
57. If you encountered any problems or if you know how to do it better, drop me a line at moremagic<N0 5PAM>.dot.gmail.dot.com Thanks.
III Appendices
APPENDIX A: autoconf Installation
A1. Go to http://ftp.gnu.org/gnu/autoconf/ and download the newest source tarball of GNU autoconf (save it in /basedir).
A2. Extract the autoconf source files in the basedir:
gunzip autoconf-2.59.tar.gz
tar -xvf autoconf-2.59.tar
A3. Change into the autoconf-2.59 directory
A4. Run the configure script:
./configure
A5. Run make:
make
A6. Run make install:
make install
A7. Clean up…:
make clean
A8. Done.
APPENDIX B libtool Installation
B1. Go to http://ftp.gnu.org/gnu/libtool/ and download the newest source tarball of GNU libtool (save it in /basedir).
B2. Extract the libtool source files in the basedir:
gunzip libtool-1.5.8.tar.gz
tar -xvf libtool-1.5.8.tar
B3. Change into the libtool-1.5.8 directory
B4. Run the configure script:
./configure
B5. Run make:
make
B6. Run make install:
make install
B7. Clean up…:
make clean
B8. Done.
APPENDIX C m4 Installation
C1. Go to http://ftp.gnu.org/gnu/m4/and download the newest source tarball of GNU m4 (save it in /basedir)…
C2. Extract the m4 source files in the basedir:
gunzip m4-1.4.4.tar.gz
tar -xvf m4-1.4.4.tar
C3. Change into the m4-1.4.4 directory
C4. Run the configure script:
./configure
C5. Run make:
make
C6. Run make install:
make install
C7. Clean up…:
make clean
C8. Done.
APPENDIX D Python Installation under Linux
D1. Gehe zu http://python.org/ftp/python/2.4.2/ and download the newest source tarball of Python (save it in /basedir)
D2. Extract the Python source files in the basedir:
bzip2 -d Python-2.4.2.tar.bz2
tar -xvf Python-2.4.2.tar
D3. Change into the Python-2.4.2 directory
D4. Run the configure script:
./configure
D5. Run make:
make
D6. Run make install:
make install
D7. Clean up…:
make clean
D8. Done.
APPENDIX E Python Installation under Solaris
E1. Download this file: ftp://sunsite.informatik.rwth-aachen.de/pub/mirror/ftp.sunfreeware.com/sparc/8/python-2.4.2-sol8-sparc-local.gz (save it in /basedir)
E2. Extract the Python binaries for Solaris:
gunzip python-2.4.2-sol8-sparc-local.gz
E3. Install the package:
pkgadd -d python-2.4.2-sol8-sparc-local
Confirm the question with <ENTER> (When an M appears, press <CTRL>+<ENTER>)
E4. Test Python:
python
If you get an error message at this point that libstdc++.so.5 can’t be found, continue with APPENDIX G
E5. Done.
APPENDIX F Libxml2 Installation
F1. Go to ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/ and download the newest source tarball of libxml2 (save it in /basedir)
F2. Extract the libxml2 source files in the basedir:
gunzip libxml2-2.6.22.tar.gz
tar -xvf libxml2-2.6.22.tar
F3. Change into the libxml2-2.6.22 directory
F4. Run the configure script:
./configure
F5. Run make:
make
F6. Run make install:
make install
F7. Clean up…:
make clean
F8. Done.
APPENDIX G libgcc Installation (Solaris)
G1. Download this file: ftp://sunfreeware.nl.uu.net/pub/freeware/sparc/8/libgcc-3.4.1-sol8-sparc-local.gz (save it in /basedir)
G2. Extract the package in the basedir:
gunzip libgcc-3.4.1-sol8-sparc-local.gz
G3. Install the package:
pkgadd -d libgcc-3.4.1-sol8-sparc-local
Confirm the question with <ENTER> (When an M appears, press <CTRL>+<ENTER>)
G4. Done.
IV Acknowledgments
Thanks to Vasudeva Martin for the helpful additions to step 47.
Thanks to Ingo Brenckmann for the BerkeleyDB note at step 7.
Thanks to Dominik Fijalkowski for the configure note at step 24.
Thanks to Sebastian for the mod_deflate note at step 24.
Thanks to Joschka Reuss for the correction of the tar command at step 9.