This article will cover using Subversion on your local machine to manage your project’s revision history. It will assume you have a basic understanding of Linux and root access. If you are looking for remote access to revisions, that is outside the scope of this article. See resources for remote access at the bottom of this article. Also, please understand that SVN is for revision history. It should not be thought of as a backup system and you should backup your repositories as you would any other file.
The first thing you need to do is install ’subversion’ using the synaptic package manager (and any dependencies). The next thing we’ll do is make a directory for our repository:
$ sudo mkdir /usr/local/svn/repos
Then, we need to make this directory owned by you and group ’svngroup’ and give read + write access to the group. Ownership of the files is very important and you will not be able to make commits to your repository without properly setting these first. You will not be directly editing any files in this folder. Doing so will break your repository.
$ sudo chown -R user:svngroup myproject
$ sudo chmod -R g+rws myproject
Next we need to import our files. You should setup a directory with the following structure:
myproject
| — branches
| — tags
| — trunk
| — all files go in here
It does not matter where you setup this directory as it may be deleted later. Now use the import command:
$ svn import myproject file:///usr/local/svn/repos/ -m “initial import”
This will import your files. You are now ready to checkout a “working copy” to edit. Do not work on any other directories we setup above. Only the working copy should be edited. You will need some sort of svn manager like RapidSVN or esvn to “checkout” your first working copy. Once changes are made, you will be able to “commit” the changes to the repository. You will be able to revert back to older copies, merge branches, etc.