Development / Tips February 7, 2011 @ 00:46

Setting up SVN on Ubuntu

On my quest to get a proper version control system installed on a cheap low-spec machine that’s always running, this is what I came up with so far. I’ll try to write a quick tutorial, just highlighting the steps you need to get it up and running. Shouldn’t be too difficult.

Before, I set it up using Apache2 on my Ubuntu machine, accessible from port 80 with a regular web browser, easy. But after a while it started being really slow and unresponsive.  After some poking around, I discovered 10 to 20 apache processes, each taking up about 5 mb. My little media-playing Atom pc was choking.

The solution I found was to get rid of Apache altogether for this purpose and just run svnserve. Much easier to set up a and quick as a bunny!

First, install Ubuntu. Leaving that up to you. You should probably know how to open a console: CTRL+ALT+F1 from the ‘desktop’ (ALT+F7 to go back to the desktop). Now we can tell the computer to do things.

Install Subversion (SVN):

sudo apt-get install subversion

Now create a repository to store our actual data. Replace “/path/to/svnRepository with the path you want to use:

svnadmin create /path/to/svnRepository

You might want to set up some protection by requiring a username and password. Type this in the console:

nano /path/to/svnRepository/conf/svnserve.conf

Nano is a simple text editor, use your arrow keys to navigate. Look for this line

# password-db = passwd:

and change it to this:

password-db = passwd:

Also, make sure you change this line

# anon-access = read

to this:

anon-access = none

Press CTRL+X to exit Nano. It will ask to save the file, press Y to confirm that.

Then we set up a password by editing the passwd file:

nano /path/to/svnRepository/conf/passwd

You’ll see some lines of text there, add one line at the end. I’ll assume your name is ‘John‘ and your password ‘ILikeLOL‘:

John = ILikeLOL

You can add more users if you like. Then again, exit with CTRL+X and press Y to confirm the write.

Protect the file:

sudo chmod 600 /path/to/svnRepository/conf/passwd

The only thing we need to do now, is start the actual svn server every time the computer boots up by creating a script as such:

sudo nano /etc/init.d/svnserve

Type in this command that will start the server as soon as the script is run:

svnserve -d -r /path/to/svnRepository

You know the drill, exit (CTRL+X) and save (Y). All done! Well, almost. Now we reboot the computer and you should have your own SVN server!

There is a fair chance that I missed something or this doesn’t work at all. If so, drop a comment below.

No Comments to Setting up SVN on Ubuntu

Add comment:

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

By submitting a comment here you grant baseone:online a perpetual license to reproduce your words and name/web site in attribution. Inappropriate or irrelevant comments will be removed at an admin's discretion.