Subversion (known as SVN) is a software versioning and revision control system distributed under an open source license. Developers use Subversion to maintain current and historical versions of files such as source code, web pages, and documentation. Its goal is to be a mostly compatible successor to the widely used Concurrent Versions System (CVS).
In this article we will discuss about how to build a simple SVN server. For this purpose I use Ubuntu (as suggested by the article title). Any version and any architecture is fine. However in this article I will use Ubuntu 12.10 desktop edition.
Our Subversion server will work on top of http protocol, therefore you have to make sure web server has been installed . The installation of web server won’t be covered here.
Install subversion and apache module (using enough privilege for installation).
apt-get install subversion libapache2-svn
Here we have install the Subversion on our machine.
Now we have to set the subversion to work. We will divide this configuration into some stage
Setting up SVN Repositories
Create a new group and set the group for svn repository. This group will have permission to access svn repository.
Create a directory for the repository. This can be any directory, however we will create a new dedicated directory for this purpose. Then set the ownership to www-data and svn-repo. Also change the permission to certain level. These commands will do:
mkdir /srv/svn chown www-data:svn-repo /srv/svn chmod g+rws -R /srv/svn
Last, make the directory as svn directory:
svnadmin create /srv/svn
Setting up Apache Module
We will modify web server so svn can be accessed by webserver.
Edit /etc/apache2/mods-available/dav_svn.conf then add some text to the end of file. Adjust the setting with your own setting (if you follow the above precisely, then you should have no problem copy paste the script below):
<Location /svn> DAV svn SVNPath /srv/svn AUTHType Basic AUTHName "Xath SVN Repository" AuthUserFile /etc/subversion/passwd Require valid-user </Location>
The SVNPath specify where the root of subversion directory (in our case: /srv/svn)
A user which want to access the svn must be valid where the authentication will use /etc/subversion/passwd to look for user and password pair.
Add User Account
The last stage is create or add user account for our subversion. To add user account to new password file use htpasswd with argument -c. If the file already exists, the -c is unnecessary. The password file should be the same with filename we specify in dav_svn.conf (see previous section). You will be asked for a password.
htpasswd -c /etc/subversion/passwd xathrya
Then try to access your svn server http://<ip address>/svn