About

    Indian engineer lost in the mysticism of life. Sometimes agnostic, sometimes full of faith, sometimes depressed, sometimes blessed. Sometimes recluse, sometimes extravagantly social. Sometimes feel the need of psychiatrist consultation.


    Sometimes love to play and compose music, sometimes make computer vision and robotics projects, very few times like to write and rarely like to read.


    This defines my life almost completely.

Keeping Your Codes Safe With SVN Tool

Being a research scholar, I understand the pain of losing your code, files or work. This has happened to me many times in the past and I always regretted for not having the backup. For last one year I am using SVN to keep my stuff safe that too with access to the past modifications.

Here is the step by step procedure to set up SVN server on a lab or local machine:

  • Download and install "subversion" package. In Ubuntu, you can go Synaptic Package Manager, select and in stall it easily.
  • Make a repository directory in a place which is possibly isolated from your work directory( e.g. /var/svn/repos/). You may need super user privilege.
    $sudo mkdir /var/svn
    $sudo mkdir /var/svn/repos
  • Make sure that you own this directory (place your user-name below).
    $sudo chown -R <username> /var/svn/repos/
  • Create an svn user by editing the following file:
    $vim /var/svn/repos/conf/svnserve.conf
    Add these three lines in the above file:
    anon-access = none
    auth-access = write
    password-db = passwd 
    The first line restricts any unauthorized access, second, allows an authorized user writing access and third, specifies the passwd file in which all the registered user are mentioned (more details below).
  • Edit/create the passwd file to create authorized users with their passwords:
    $vim /var/svn/repos/conf/passwd
    Specify the name of the user and the corresponding password in the following format:
    achint = mypassword
  • Though you can add your files to the repository now, but I would strongly recommend you to first checkout the repository and add your files one by one to it. For this first start the svn server as a demon (it will run in the background):
    $svnserve -d
  • Checkout the repository directory:
    $svn co svn://<SVN Server IP>/var/svn/repos
    This will create a local directory "repos" in your current directory.
  • Add your files/codes to the repository by first, pasting files in "repos" directory and then add those files in the svn:
    $svn add <fileName>
  • After adding all the files in svn, commit the changes made by the following command:
    $svn commit
For further details you can see SVN man pages or this tutorial here.