Setup Subversion (SVN) Repositories on Debian/Ubuntu

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[general]anon-access = noneauth-access = writepassword-db = passwdauthz-db    = authz[sasl]EOF

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



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


[/]YOUR_USERNAME = rw[/]YOUR_USERNAME = rwother = 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 <<EOFservice svn{        port        = 3690        socket_type = stream        protocol    = tcp        wait        = no        user        = svn        server      = /usr/bin/svnserve        server_args = -i -r /var/svn/repositories}EOF

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

No comments

Powered by Blogger.