Deprecated: Assigning the return value of new by reference is deprecated in /f2/blendedtechnologies/public/wp-content/plugins/pmetrics.php on line 1192
Blended Technologies » Blog Archive » Setting up Subversion on Ubuntu (Hoary and Breezy)

Setting up Subversion on Ubuntu (Hoary and Breezy)

Basically I wanted a versioning system where I can track/version whatever files I feel like. I mostly want to track projects though. Here’s what I went through to set this up, I call it:

The 10 minute guide to setting up Subversion on your Linux system (somewhat securely maybe?)

  1. Step 0.
    Use apt-get or the Synaptic package manager to install these programs:
    Install Subversion
    Install netkit-inetd (For Breezy only)
  2. Step 1.
    After I made a directory for myself I created two* new repositories to start me off:
    chiefinnovator@server1:/$ svnadmin create
    /home/chiefinnovator/svn_repositories/blendedtechnologies
    chiefinnovator@server1:/$ svnadmin create
    /home/chiefinnovator/svn_repositories/misc

    blendedtechnologies will be the repository for a project I’m currently working on.
    misc will hold documents and whatever files don’t belong to a specific project.
  3. Step 2.
    Here’s the best way I knew how to get the structure I wanted into my new repositories. I created a new folder, called it svn_structure, and created the 3 subdirectories which I want in all of my repositories: trunk,branch,tag.
    Then I imported this directory into each of the repositories:

    chiefinnovator@server1:/$ svn import
    /home/chiefinnovator/svn_structure
    file:///home/chiefinnovator/svn_repositories/blendedtechnologies -m
    "initial import"

    chiefinnovator@server1:/$ svn import
    /home/chiefinnovator/svn_structure
    file:///home/chiefinnovator/svn_repositories/misc -m "initial import"

    Note: The repositories are still empty, I plan on adding content later through the normal commit process.

  4. Step 3. *
    Add to /etc/inetd.conf:
    svn stream tcp nowait chiefinnovator /usr/bin/svnserve svnserve -i -r
    /home/chiefinnovator/svn_repositories

    This tells some kind of Linux server thingy to serve up subversion when a request comes in on the subversion port, 3690. There’s a different file around here too where you can change the ports if you need to, don’t remember the name though…
  5. Step 4.
    In each of your repositories, in the conf directory make sure you have to files: svnserve.conf and users
    Make sure you have values similar to this in them:
    Conf file:
    [general]
    anon-access = none
    auth-access = write
    realm = project name here (no spaces?)

    users file:
    [users]
    any user name you want=any password you want (no spaces?)

And now you have a running Subversion setup. Maybe restart your computer first? Now you can access your repositories from any computer by typing in the url into your subversion client. My url’s for example are:
svn://111.111.1.1:3690/blendedtechnologies (replace the 111.111.1.1 with your IP address, open 3690 on your router, etc)
and
svn://192.168.1.4:3690/blendedtechnologies (For me to access from within my own network using the local IP address)

Please leave comments and correct all my mistakes here! Another entry will address writing a post-commit script to automatically send the content to my live web server directory so I don’t have to manually publish files every time I change something.



* The Subversion experts say that deciding whether to put everything in one repository or make seperate ones for each project is a trade-off between having more repository management overhead and losing tracking/organization ability respectively. I’m hoping to find a good balance by keeping all of the seperate project repositories in one directory so that I can track and organize them independantly yet still be able to easily automate administrative tasks such as backups.



* Another setup option is to server your subversion through Apache. This Subversion cheatsheet page says there is an easy way to make Subversion work through Apache. The summary is:
Using Apache 2.0, compile and copy or copy the Subversion Apache module into the Apache modules directory. The following two files must be uncommented or added to the httpd.conf file:

LoadModule dav_module modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so

Next, you must setup a location directive in the httpd.conf file to associate a directory with Subversion repositories. This example uses the SVNParentPath setting to point to a parent directory which contains repository subdirectories. This is convenient as it allows you to add as many repositories as you need without having to restart Apache or modify the httpd.conf file.

		<location /svn>
			DAV svn
			# All repos subdirs of d:/svn
			SVNParentPath D:/svn
		</location>
del.icio.us |  Digg |  FURL |  Yahoo! My Web 2.0 |  Reddit

23 Responses to “Setting up Subversion on Ubuntu (Hoary and Breezy)”

  1. Dguedry Says:

    This how-to is greatly appreaciated. Great job.
    Soap Box : However, it’s quite ironic that these open-source products are overly complex in terms of installing on an open-source OS (Linux - Ubuntu).
    I can’t for the life of me get this thing integrated with Eclipse (yet another open-source product) on localhost. Although a strong believer and starch proponent of open-source (not to mention, handy w/ the details of Open_Source and sysadmin), I can’t get over the fact that NONE of these OPEN-SOURCE products integrate seamlessly. It’s a royal pain in the ass that makes me want (with extreem displeasure) to embrace Microsoft.
    I’m sure someone will give me code-changes and system-level-dysfunction instructions, but the point is this : I EXPECT TO INSTALL A PIECE OF SOFTWARE AND HAVE IT WORK SEAMLESSLY… as it does w/ (painfull to say these words) Windows and the M$ development kit…. Thanks for letting me vent here. I do appreciate this very helpful how-to… it gets me much farther than anything else I’ve come about.

  2. Administrator Says:

    Glad I could help, Dguedry. Drop me an email if you have any other questions. Also trying stopping by the Subversion mailing list, they’re helpful.

    As for you open source complaints, you won’t get any argument from me. Products like Ubuntu certainly give me hope though. Just 5 years ago you to be an expert to even think about running Linux. I’m sure we’ll get there yet.

  3. Dguedry Says:

    I think you are absolutely correct (open-source). In time, we’ll arrive. I just hoped we’d be closer by now. Pinned up frustrations I guess. I too think that Ubuntu (since it’s less Capitalist) will exceed where all others have failed. Thank YOU, sir.

  4. Doofus Says:

    Thanks very much for your HOWTO, I had a new subversion repository running on my fresh ubuntu server in minutes. One thing that I would still like to do, however, is access the repository using the svn+ssh:// protocol. I already have a working sshd setup.

    After reading the subversion guide:
    http://svnbook.red-bean.com/nightly/en/svn.serverconfig.svnserve.html#svn.serverconfig.svnserve.sshauth

    I had imagined that the exmaple shown there should work out of the box, but it doesn’t (at least for me).

    Do you have any insights into configuring this?

    Thanks again,
    D.

  5. Administrator Says:

    Hey Doofus ;-)

    I’ve never tried running svn+ssh but I’ll at least look over the example and see if I come up with anything.

    I’ll post back here in a few days.

  6. Administrator Says:

    Doofus,

    I looked at the SSH+SVN documentation. It doesn’t look like something I could figure out in a night :-(

    I’d try hitting the ubuntu mailing lists or forum, or possibly the Subversion mailing list for help.

    If you do solve this puzzle and want to write a detailed how-to, you’re welcome to post it here. In any case, do keep me updated.

  7. ranter Says:

    Open source needs documentors. Document your problem, percieved problem and post it…then hopefully a programmer will make your instructions obsolete, or you will learn a language capable of configuring the problems you were having. Seemless integration is a product of blood, sweat, tears and testing testing testing.

    Best wishes with your pursuits.

  8. data center disaster recovery plan Says:

    Excellent point of view. I wish there were more comments like this. I must say this is one of the betters sites I have come across –Regard, Nick

  9. Raven Says:

    Please detail what permissions are on each of the folder/files. I use Centos and have been trying for a week to get Subversion up and running. It works fine from local, but when using a client like TortoiseSVN I can’t seem to make a connection. It looks like a permissions error as it says the files aren’t there, when they really are.

  10. Greg - CEO/Founder Says:

    Raven,

    I didn’t change any permissions when setting this up. How about starting out with full permissions and seeing if that works. If it still doesn’t then you’ve ruled out a permissions problem.

    If that does work, then gradually remove permissions until it stops working, and leave them one level above that.

    If that doesn’t help, give the mailing list a try. You’d want to use the users@subversion.tigris.org list.

  11. ceeKay Says:

    I found that on my system (ubuntu) I had to enter “tcp” not “TCP” due to the way it was specified in my /etc/services file

  12. ceeKay Says:

    Rather, I had to enter

    subversion stream tcp nowait user /usr/bin/svnserve svnserve -i -r
    /home/user/svn_repositories

    I’m on breezy I believe…

  13. kalahari875 Says:

    Using apache2 on Breezy, the node above has to be added to /etc/apache2/apache2.conf, not httpd.conf (which is an empty file).

  14. Greg - CEO/Founder Says:

    Thanks for the tips ceeKay and Kalahari!

  15. Steven Van Ingelgem Says:

    Small help on breezy (probably will work on Debian too):

    # apt-get install netkit-inetd subversion
    # echo “svn stream tcp nowait svn /usr/bin/svnserve svnserve -i -r ” >> /etc/inetd.conf
    –> be sure that you use tcp in small letters, capitals won’t work!
    # /etc/init.d/inetd restart

  16. Jawaad Ahmad Says:

    Thanks for the instructions! I followed these instructions while reading Chapters 5 and 6 of the Subversion manual (http://svnbook.red-bean.com/). The steps are the same in both places, but the manual describes everything in great detail. Thanks for trimming it down to the basics!

    I did have one problem. I opened port 3690 on my router to allow access from the outside. This alone did not work. If I tried to do an svn checkout from inside the LAN, I had no trouble, but if I tried using my external IP address, I think I got a “Connection refused”. I even tried a simple telnet on port 3690 and it worked from inside, but not from outside.

    It wasn’t until I opened port 80 along with port 3690 that the problem went away. After opening both ports 80 and 3690, I could do an svn checkout without any problems.

  17. Greg - CEO/Founder Says:

    Jawaad,

    Glad it worked out for you. I’m not sure offhand why you would need to open port 80. But it’s good you got it figured out.

  18. Alfonso Says:

    Just what I needed! After a few attempts, I was ok in minutes. Now, it would be nice to know what you need to set up this so that is accesible using the svn protocol over ssh. Does the Tortoise SVN plug in works with the ssh protocol?

  19. Sam Says:

    Thank you, you helped me out :-) *happy*

  20. Gapper Says:

    I am getting ready to install Subversion on Ubuntu. I am not sure whether or not I should use the Desktop or Server edition of Ubuntu. This is the only application we will be running on the Linux box, and it will serve Windows machines over a network. I have read the Desktop version is easier to manage but my instincts are screaming Server version. I have only a very basic knowledge of Linux. Any insight on this?
    Thx

  21. Greg - CEO/Founder Says:

    Gapper,

    I don’t think you’ll have any trouble with the server version. The best way to go is to try the server version first, if you find you have any issues that a GUI might help with, then switch over to regular Ubuntu. I’m pretty sure the server version would be fine.

  22. Windows free LAN « Ubuntu 9400 Says:

    […] Migrate the subversion repository from the bitbucket to the Ubuntu machine. Easily done. Backup the repository on bitbucket, create a new repository on the Ubuntu machine and load from the backup. Notes here and here. […]

  23. swamy Says:

    Hi,

    I f u have any idea on subversion setting in centos5, please publish , i got errors .