Subversion (SVN) is a version control system. It is used to maintain current and historical versions of files such as source code, web pages, and documentation. It is to the widely used Concurrent Versions System (CVS).
See http://en.wikipedia.org/wiki/Subversion_(software) for further information about the application and version control in general. Subversion is open source / free software.
Subversion (SVN) is used by many open source projects such as: Apache Software Foundation, KDE, GNOME, Free Pascal, GCC, Python, Ruby, Samba and Mono. SourceForge.net and Tigris.org also provide Subversion hosting for their open source projects.
The Apache HTTP Server is a heavy duty network server that Subversion can leverage. Via a custom module, httpd makes Subversion repositories available to clients via the WebDAV/DeltaV protocol (see http://en.wikipedia.org/wiki/WebDAV), which is an extension to HTTP 1.1 (WebDAV: Web-based Distributed Authoring and Versioning). This protocol takes the ubiquitous HTTP protocol that is the core of the World Wide Web, and adds writing - specifically, versioned writing - capabilities. The result is a standardized system that is conveniently packaged as part of the Apache 2.0 software, is supported by numerous operating systems and third-party products, and doesn't require network administrators to open up yet another custom port.
The Apache-Subversion server has more features than svnserve, and consequently is a little more difficult to set up; with flexibility often comes more complexity. There are numerous other features of the Apache and Subversion relationship that make this an attractive option, including:
In all cases it is only necessary to compile support for the features required into Subversion and Apache, and properly configure the programs to use those features.
The following is guidance that might be useful in helping to configure Subversion (SVN) on an Apache Web-server running on a Linux server.
Subversion (SVN) is a fairly standard install on Linux (e.g. if Red Hat download RPM, unpack, install.
See http://subversion.tigris.org/ for details.
Some directories and file permissions needed to be established first, then create the repository and update the hooks file to log some messages:
# mkdir /var/svn/repository # chown apache:apache -R /var/svn/repository/ # chmod 0770 -R /var/svn/repository/ # # svnadmin create /var/svn/repository/example # svn import /home/peter/utils/ file:////var/svn/repository/example/trunk -m "Initial import" # # cd /var/svn/repository/example/hooks # cp /tmp/post-commit . # # vi post-commit
Just to prove it has all worked list out some repository details:
# svn log file:////var/svn/repository/example/trunk ------------------------------------------------------------------------ r1 | root | 2008-04-04 15:05:28 +0100 (Fri, 04 Apr 2008) | 1 line Initial import ------------------------------------------------------------------------ # # svn list --verbose file:////var/svn/repository/example/trunk 1 root 13497 Apr 04 15:05 MyCopyToRemote.sh 1 root 10716 Apr 04 15:05 MyFileCopy.sh ... ... 1 root 8310 Apr 04 15:05 MyFramework.sh 1 root 16310 Apr 04 15:05 MyLogFileReport.sh 1 root 350 Apr 04 15:05 MyNSLookup.sh 1 root 2800 Apr 04 15:05 create_backup_v0.6.sh ... ... 1 root 85 Apr 04 15:05 my-sql-readme.txt 1 root 583 Apr 04 15:05 vsftpd_ip_monitor.sh #
After experimentation I arrived at the following /etc/httpd/conf.d/subversion.conf configuration file, which keeps the Subversion stuff out of the main Apache /etc/httpd/conf/httpd.conf configuration file.
The two configuration files were modified as follows and then the Apache daemon (httpd) restarted:
vi /etc/httpd/conf.d/subversion.conf vi /etc/httpd/conf/httpd.conf service httpd restart
Edit the Subversion configuration file to include the following:
===== subversion.conf fragment ===== LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so # ... <Location /svn/repository> DAV svn # any "/svn/foo" URL will map to a repository /var/svn/foo SVNParentPath /var/svn/repository # access control policy AuthzSVNAccessFile /etc/httpd/conf/.svn.auth # restrict to LAN for now Order deny,allow Deny from all Allow from 192.168.1.0/24 # how to authenticate AuthUserFile /etc/httpd/conf/.htpasswd AuthType Basic AuthName "Subversion Repository" Require valid-user # Limit write permission to list of valid users. <LimitExcept GET PROPFIND OPTIONS REPORT> # how to authenticate Require valid-user </LimitExcept> </Location> ... =====
The HTTPD (Apache) configuration file was updated to include the following alias to allow browsing of respository files via a web-browser:
==== httpd.conf fragment ===== ... # Aliases: Add here as many aliases as you need (with no limit). The format is # Alias fakename realname # # Note that if you include a trailing / on fakename then the server will # require it to be present in the URL. So "/icons" isn't aliased in this # example, only "/icons/". If the fakename is slash-terminated, then the # realname must also be slash terminated, and if the fakename omits the # trailing slash, the realname must also omit it. # ... Alias /development-repository "/var/www/html/dev" ... =====
There are numerous other entries to secure the web-server, etc, in the Apache /etc/httpd/conf/httpd.conf configuration file: see the Apache documentation for details.
Attempts to access the repository from Apache using various URLs resulted in the following:
http://www.domainame.org.uk/svn The webpage cannot be found http://www.domainame.org.uk/svn/repositiory Prompted for password Then the error/warning message: You don't have permission to access /svn/example on this server. http://www.domainame.org.uk/svn/repository/example Prompted for password Then, access granted: Revision 1: / trunk/ -------------------------------------------------------------------------------- Powered by Subversion version 1.1.4 (r13838).
Clicking on the trunk/ link moves into the repository directory.
If you are looking to connect Subversion (SVN) from Windows 2000 or XP client system you can use TortoiseSVN; it has an execllent interface to Subversion Control. As is the case with Sub iteelf this is a free/open source application.
The following quote is from the project home page:
"TortoiseSVN is a really easy to use Revision control / version control / source control software for Windows. Since it is not an integration for a specific IDE you can use it with whatever development tools you like. TortoiseSVN is free to use".
Subversion (SVN) can use the HTTP-based WebDAV (thus port 80, which would usually be open by default if say an Apache server was running on the Linux box).
With TortoiseSVN All Subversion protocols are supported:
TortoiseSVN requires Win2k SP4, WinXP or later.
For general links to useful references when setting up Subversion see: Apache resources on the Internet.
URL | Summary/Description |
---|---|
http://subversion.tigris.org/ | Main Subversion site |
http://tortoisesvn.tigris.org/ | Main TortiseSVN site |
http://www.cyberciti.biz/tips/tortoisesvn-windows-subversion-client.html | General TortiseSVN site |