In this day and age, if you are a developer and not using some kind of version control for your applications, then you need to give yourself a kick up the backside and start updating your skillset. I recommend starting with Subversion (SVN) as this offers complete control over your repository and is also widely used, so there are plenty of Blogs and articles knocking about on Google.
First of all you need to install SVN on both your server and local machine. I will write another article on how todo this, however most recent linux distributions on Webservers come with SVN installed by default. Once you have done this, its time to create a repository. So now SSH into your server and type the following: -
svnadmin create /path/to/repository
this will create a new repository at /path/to/repository
Next we need to configure SVN and tell it what users are allowed access etc. We do this by editing svnserve.conf. So, type: -
vi /path/to/repository/conf/svnserve.conf
and add insert/un-comment the following lines in the svnserve.conf file.
anon-access = none
auth-access = write
password-db = passwd
Next up is to actually create the password file by typing: -
vi /path/to/repository/conf/passwd
Each user should be added on a separate line in the following format, myuser = mypassworde.g.joe = mypassword
You have now completed the setup, and ready to start the SVN server. To do this type: -
svnserve -d
Your SVN server should now be online and ready to use. To test it type the following on your local machine. It will list everything inside the repository (it will be empty): -
svn list svn://mydomainname.com/path/to/repository
The final step is to import a project into your repository, then check it back out so you can continue development and store all changes in your SVN repository. To import, type the following on your local machine (it assumes you are inside the projects root directory): -
svn import ./ svn://mydomainname.com/path/to/repository/myproject -m 'initial import'
Once this has completed, you now need to delete your local copy of the project (or move it if you are scared :-P ). To do this type: -
cd ..
rm -Rf myproject/
You are now ready to get a version controlled copy of your project on your local machine. To do this type: -
svn co svn://mydomainname.com/path/to/repository/myproject ./myproject
And so there you have it, you now have your very own version control system, which could save you hours of frustration later down the line if you need to revert your application back to an old version.
Happy SVNing!


