Subversion and Subclipse installation and Configuration

Ever wanted to have a code repository of your own? Either working on a small project or working with your friends on the next big thing, it would be great to have a repository where you can maintain your code, just as you would while working at your office. Lot of you might have been using version controls at workplaces such as CVS, VSS etc. Many will have an urge to maintain their homework using a version control mechanism. But is it all that easy? Well, it isn’t a one-go shot for a starter. Here is this post throwing light on how precisely to do that.

For beginners, probably the only thing relatable is the name of the version control alone, but how to get it, how to install it, how to configure it and then how to use it, will all be things to follow. There are many open-source free version controls available, do explore their features and chose the one best for you. This post though specifically guides your way through installing and configuring Subversion. Before reading the rest of the post, it would be helpful to get into a primer about subversion / subversion client / using subversion locally/ using subversion remotely etc. For a comprehensive look into subversion, read it hereSubversion is a small and simple enough version control to run on a development machine to give a full-fledged source code control.

Manual Download/Installation/Configuration of subversion:

Here are the list of few links that should help get started with manually installing and configuring subversion:

Most of the softwares (subversion, TortoiseSVN, Apache Server, subclipse) are version-dependent, so you should always install the latest version of each and be certain of the compatibility.

In a nutshell:

Subversion: Subversion is an open source version control system  similar to CVS in many respects used primarily by developers to keep every revision of important and frequently changing files. One major differing component is that, unlike CVS, there are multiple means of accessing your repositories. There are two popular svn-servers, the built in svnserve that comes with the subversion installation and the more advanced option, i.e., Apache server with svn plugins. Subversion is like a wiki-like repository for your files. Each time you make a change to a file or group of files that you’re happy with, you can commit those changes to your Subversion repository. If you don’t like with the changes, Subversion can compare your current version with any previously-committed version and pick out the best so you never have to worry about finding your way back to a good or working version of a file. Once you have a sharable repository, you can work with your team and work with the same piece of source controlled code.

Tortoise SVN: Tortoise SVN is a Subversion client for Windows that makes dealing with Subversion repository easy. Tortoise isn’t a program but more of a shell extension and provides much like a front-end UI to access subversion. To interact, all you do is  right click in Windows Explorer and find the SVN specific commands such as  ”SVN Checkout”.

Apache Webserver: One of the more popular, and flexible ways of connecting to a subversion repository is through the use of the Apache 2 Web server. You will not need Apache 2 Web server though, if you plan on using the repository locally. You can choose to run Subversion without the server component (Apache) and it still works wonders for keeping versioned copies of your files locally. The only big miss is you won’t be able to access your files from other computers and via internet.

Subclipse: Subclipse is an Eclipse Team Provider plug-in providing support for Subversion within the Eclipse IDE. Using this plugin, you can access the repository.

Doing it the easy way – VisualSVN Server:

This is an easy choice for those who not only want to just set up subversion repository but also access it from other computers in the network LAN or via internet thro’ Apache server almost instantly. VisualSVN server sets up a typical Subversion installation for team work involving a single server machine being accessed from clients on computers all over the office or, perhaps, all over the world. There are many ways to configure Subversion server. VisualSVN Server is a package that contains everything you need to install, configure and manage Subversion server for a team on a Windows platform. It includes Subversion, Apache and a easily configurable management console.

Downloading / Installing / Configuring VisualSVN server is as easy as installing just about any other software in your system. Download it here. Follow the straight forward installation steps here. That’s it, you are not just done with setting up subversion repository in your preferred location, but also end up with lot many goodies such as a very user-friendly management console to create / delete / modify repositories, manage user accounts / authentication / privacy settings,  a default tree structure for repository (branch- a code that might not make it to a release, tag – code tagged for making it to a release, trunk – your code should be under this directory), and also Apache server installed with choice of access between http or https (secure). A  petite all in one goodie I must say!

Is it all done?

Accessing SVN via internet:

Either you have manually set up subversion with Apache or installed thro’ VisualSVN server, you will be all set to use your code repository in a network and also access it from within Eclipse IDE using subclipse plugin. Before you cheer up that you can now share your code repository with friends all over the world, there’s a small catch, but no worries! The catch is that if you are excited about sharing your code via http / https, say something like http://localhost:port/svn/ set during configuring VisualSVN server, you will be sad to realise that this will only work in your intranet behind your local router and your friends on the other side of the router can’t access it via internet.

The reason is that, though your computer is now a svn server and has a code repository with a url to be accessed, it’s working behind a router which does not forward external web requests to your svn server. There are few work arounds for this, such as using “port forwarding” on your router, but I would suggest a safer option. And that would be to opt for a free SVN hosting service, where in a third party server will host your code repository 24/7  and provide you with a easy management console and also a url that you can then share with your friends. Have a look at these options:

Note:  Exposing web access to your computer is always bit risky provided your computer is well protected, using https via SSL (easily-configurable in VisualSVN server) is a much safer option. The default port for listening http request is 80, where as for https is 443.