Tuesday, 15 February 2005
Subversion HOWTO ---------------- Source: http://www.vtk.ugent.be/svn/ikke/docs/Subversion-Howto.txt
1. Server side *********** - Get the Subversion server components We will be running Subversion based on the Apache webserver. This implies we're forced to use version 2 of this webserver, because as far as I know the Subversion isn't compatible with Apache 1.x. On Gentoo: emerge dev-util/subversion Watch out!!! If you *are* running www-server/apache on this machine, you *have* to set the "apache2" USE-flag, otherwise your installation will most certainly break.
- Create space to store repository data. In this howto, we'll store all data under /var/svn, using REP as sample repository name. cd /var mkdir svn cd svn mkdir repos svnadmin create repos/REP chown -R apache:apache REP cd .. mkdir conf
- Configure Apache We won't use the "standard" Gentoo way to set up the server, but do it manually. Edit your Apache configuration file of the host where you want to make your repository aviable (e.g. /etc/apache2/conf/chosts/vhosts.conf), and look up the domain entry. Edit it so it looks like this (well, not exactly, just add the necessary lines. I assumle you know how to edit Apache configuration files).
ServerName www.mydomain.com DocumentRoot /var/www/com.mydomain.www #DAV stuff LoadModule dav_module modules/mod_dav.so DavMinTimeout 600
#SVN stuff LoadModule dav_svn_module extramodules/mod_dav_svn.so DAV svn SVNPath /var/svn/repos/REP AuthType Basic AuthName "REP Subversion repository" AuthUserFile /var/svn/conf/svnusers.REP Require valid-user
Basicly, this loads the DAV modules if necessary, then loads the Subversion module, and then defines a repository, located on http://www.mydomain.com/REP
First check if your config file is valid: apache2ctl configtest should return "Syntax OK" Now restart your webserver: apache2ctl graceful
- Add users to the list of allowed users (= users with write access to the repository. In this setup, everyone got read access). In this HOWTO, we'll add a user called "username" cd /var/svn/conf htpasswd2 -c svnusers.REP username (enter password) chown apache svnusers.REP chmod 0640 svnusers.REP
- Now become a normal user to test this setup: cd mkdir svntest cd svntest svn --username username co http://www.mydomain.com/REP cd REP touch test svn add test svn commit (add some comment)
If all went fine, your server is done. If not: moeha.
We added a file to the repository while testing, so maybe it's a good idea to reset the repository to the initial state: su - root cd /var/svn/repos rm -rf REP svnadmin create REP chown -R apache:apache REP
Done 2. Client side use *************** - First we need to checkout the repository svn --username username checkout http://www.mydomain.com/REP A folder called "REP" is created now.
Now you can: * Create directories in the repository svn mkdir adirectory
* Add files to the repository vim afile svn add afile
* Commit your changes to the server svn commit (enter some description of the changes you made) (enter password)
* Update your local copy of the repository to get the changes team members made svn update
There are lots of things you can do: get diff's, revert to older versions,... All these commands look like their CVS counterparts (http://www.gentoo.org/doc/en/cvs-tutorial.xml, replace "cvs" with "svn").
To browse files graphically, you can use Viewcvs-1.0-dev (this version can read Subversion repositories) (TODO: explain how to install this, explain what Viewcvs is). You can also use RapidSvn (http://rapidsvn.tigris.org) (on both Windows and Linux).
If you're a Windows user, you should check out TortoiseSVN (http://tortoisesvn.tigris.org) which is the SVN counterpart of TortoiseCVS, and integrates with Explorer. |