Setting up Ubuntu SVN server and NetBeans client

The following recipe will show you how to setup an SVN repository on an Ubuntu Gutsy server and then connect from an external Windows NetBeans instance via svn+ssh protocol. The whole process is actually much simpler than I first imagined and should only take about 10 minutes.

Start off by logging into your Ubuntu server and opening a command prompt, then run the following two commands to install the SVN server packages:
sudo apt-get update
sudo apt-get install subversion
Next, create a user that will own the SVN files and act as the SVN admin, let's say 'svn':
sudo adduser svn
Give the user a password and leave all the details blank (or make something up if you wish).

Next create a directory where you want your SVN repositories to be located:
sudo mkdir /var/svn
Now it's time to create the actual repository:
sudo svnadmin create /var/svn/repos
And make the svn user the owner of the repository:
cd /var; sudo chown -R svn svn;
And that's about it from the server side of things. To connect to this repository via the svn+ssh protocol you'd run the command:
svn+ssh://svn@hostname/var/svn/repos
To connect from NetBeans you'd right-click on your project, click Versioning, click Import into Subversion repository, type svn+ssh://svn@hostname/var/svn/repos into the Repository URL, download putty.exe and plink.exe to a local directory anywhere on your system and add them to your system PATH, then type plink -l svn -pw password into the Tunnel Command text field and you're done!

UPDATE: After restarting my computer and trying to commit some changes from NetBeans, I was presented with the error "Can't create tunnel: The system cannot find the file specified." Turns out that this is a common problem. The solution is to manually edit the Subversion config file located at %APPDATA%/Subversion/auth/ with the location of plink.exe and the svn username & password as documented on the NetBeans wiki here. In my case, I just added the line ssh = $SVN_SSH plink.exe -l username -pw password to the config file, restarted NetBeans and I was able to successfully commit again.

Comments

Popular posts from this blog

Wkhtmltopdf font and sizing issues

Import Google Contacts to Nokia PC Suite

Can't delete last blank page from Word