Setting up SVN using svn protocol on Linode/Debian

1 Oct

In my previous experience, trying to get source control to function minimally was an extremely daunting task. Need to set up a repository? Good luck getting it to be publicly accessible. Therefore, when I was trying to set it up for the first time, I went with the basic out-of-the-box solution: Apache + WebDAV protocol. After all, it listens on the HTTP port and hey, I DON’T have to go dewy-eyed at those port numbers, do I?


But WebDAV isn’t that secure. After all, it’s a publicly accessible URL link. Sure, you could try security through obscurity, but at this point we’re getting paranoid. Who’s going to hack my 5 hits a year site for which the majority of traffic comes from Googlebot crawling for my very specific niche text content?


The point I want to make here though, is that there is an smoother way to get your repository out for access. And that is through the SVN protocol, or svn://, which uses the port 3690 by default.


I was afraid that i’d have to google quite a bit for obscure and incredibly specific solutions to my specific problem, but turns out that replacing the more specific” Debian/Linode” for “Linux” makes it general enough to fit my needs.


So let’s get started. Using the one-click (or keypress) wonder that is the Linux package manager, I did

apt-get install subversion

Of course, depending on your flavor of Linux, you may have to resort to

yum install subversion

instead. The version you get is as old as what the package manger fancies, and manual installation for the latest version is out of scope here.


Next, create a parent directory for the repositories, I went with /subversion. In it, create another directory to contain your first project. Then do

svnadmin create /subversion/myfirstproject

replacing with your project/desired directory layout, of course.


The next step for svnserve daemon access, is to have usernames and passwords! For some reason they’re stored in plaintext – by default in 


Which, when I first discovered to my horror, was like one giant plot hole in the story of security. I guess it’s not bad considering that anyone being able to see it means you have far bigger questions about how they got into your server in the first place, but at that time I assumed that plaintext was for baddies. Anyway, add in a user password combo, examples area already given in the pre-generated file.


Now, if you’re like me, there is already an existing project for which millions of LOC (lines of code) are held in the indeterminate state of who wrote what?. Which is why I’m installing subversion in the first place – to keep track of my changes and facepalm at the silly variable declarations I did a year ago when “var” was a fancy keyword in javascript. I kid. No one is THAT clueless. Or better not be.


Regardless, navigate to the directory where your project resides, and then do

svn co file:///subversion/myfirstproject

Which is a shortcut for accessing the repository via the local filesystem. Now that the directory is one big working copy, let’s add in the files!

svn add –force *

svn commit –username user –password pass


Now we’re all good to go! 


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: