Setup Subversion (SVN) Repositories on Debian/Ubuntu

Posted on

Install required packages

We are going run SVN under xinetd for low resource usages.

apt-get install xinetd subversion

Create svn user

adduser --system --home /var/svn --disabled-password --disabled-login --group svn

Create your first repository

svnadmin create /var/svn/repositories

Run following commands to insert settings into /var/svn/repositories/conf/svnserve.conf

cat >/var/svn/repositories/conf/svnserve.conf <<EOF
anon-access = none
auth-access = write
password-db = passwd
authz-db    = authz


Edit /var/svn/repositories/conf/passwd to add user and password.



Edit /var/svn/repositories/conf/authz to modify user permission.



other = r</pre>

Note: r = read only; rw = read & write

Run following commands to create a xinetd configuration file for Subversion at /etc/xinetd.d/svnserve

cat >/etc/xinetd.d/svnserve <<EOF
service svn
        port        = 3690
        socket_type = stream
        protocol    = tcp
        wait        = no
        user        = svn
        server      = /usr/bin/svnserve
        server_args = -i -r /var/svn/repositories

Restart xinetd, and you are done.

/etc/init.d/xinetd restart

Final Check

Make sure Subversion is running using following command:

netstat -ant | grep ':3690'

You should see something like this if Subversion is running:

tcp        0      0  *               LISTEN

Remember to open port 3690 if you have firewall installed.

You can now access your Subversion repository using svn://YOUR_HOST/ from any SVN client.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

Leave a Reply

Your email address will not be published. Required fields are marked *