How To Setup Web SVN Server: Subversion
What is Subversion?
Subversion or SVN is an open-source version control system. SVN manages files and directories, and the changes made to them, over time and allows you to recover older versions of your data. You can also examine the history of how your data changed.
SVN can operate across networks, and allows users to work in collaborative manner, different people can use it from different computers at the same time, without worrying about loosing any data. SVN automatically manages and records the changes.
Setting up a Web SVN Server
Before you set up Web SVN Server, you need to following.
- Functional Linux installation
- Apache installed and running, Click here for assistance
1. Install subversion and DAV using the following command
# yum install subversion mod_dav_svn
2. Create the subversion directories
# mkdir /var/svn # mkdir /var/svn/conf # mkdir /var/svn/repos
3. Edit the Apache subversion configuration
# nano /etc/httpd/conf.d/subversion.conf
4. Paste the following into subversion.conf
<Location /svn> DAV svn SVNParentPath /var/svn/repos AuthzSVNAccessFile /var/svn/conf/authz Require valid-user AuthType Basic AuthName "Authorization Realm" AuthUserFile /var/svn/conf/passwd </Location> <Location /websvn> Require valid-user AuthType Basic AuthName "Authorization Realm" AuthUserFile /var/svn/conf/passwd </Location>
5. Create the subversion user file
# nano /var/svn/conf/authz
6. Paste the following into authz
[/] * = your_user = rw
This means that for the / directory, give read/write access to “your_user” and no access to everyone else (*).
7. Create the subversion password file
# htpasswd -c /var/svn/conf/passwd your_user
8. Download, extract, and setup WebSVN
# cd /var/www/html # wget http://websvn.tigris.org/files/documents/1380/45610/websvn-2.2.0.tar.gz # tar -zxf websvn-2.2.0.tar.gz # mv websvn-2.2.0 websvn # cd /var/www/html/websvn/include # cp distconfig.php config.php
9. Edit the WebSVN configuration file
# nano config.php
Edit the following lines (once nano is open, use it’s find feature to locate the lines)
These lines may need to be uncommented, do this by removing the “//” in front of them, also there are lots of extra configuration varaibles in here which you can read about to see if you want/need to change them.
10. Restart Apache
# /etc/init.d/httpd restart
11. Create your first repository
# svnadmin create /var/svn/repos/test
That’s it, now you should be able to browse to http://localhost/websvn to see your subversion repositories, as well as use subversion on the command line.