Wednesday, March 26, 2008

Setup of a local LAN svn server

In this article I will show you how to setup a local LAN svn server.

It assumes that you have all the tools already installed in your main server.

First lets create a new svn repository

$ svn create /home/user/SVNREPO
This creates our local SVNREPO folder, we will have to add projects on it

$ mkdir tmpdir
$ cd tmpdir
$ mkdir projectA
$ mkdir projectA/trunk
$ mkdir projectA/branches
$ mkdir projectA/tags
$ mkdir projectB
$ mkdir projectB/trunk
$ mkdir projectB/branches
$ mkdir projectB/tags

$ svn import . file:///home/user/SVNREPO --message 'Initial repository layout'
Adding projectA
Adding projectA/trunk
Adding projectA/branches
Adding projectA/tags
Adding projectB
Adding projectB/trunk
Adding projectB/branches
Adding projectB/tags

Committed revision 1.
$ cd ..
$ rm -rf tmpdir


There goes our project layout.

Now to access the svn through LAN, we'd use the svnserve command
Assuming our main server is 192.168.0.1, here is what we do

In server
$ svnserve -d -r /home/user/SVNREPO

And to authenticate our users so that to track of who changed what
we'll change the /home/user/SVNREPO/conf/svnserve.conf file

Uncomment these lines /home/user/SVNREPO/conf/svnserve.conf
[general]
anon-access = read
auth-access = write
password-db = passwd

And to add the authentication information in new file
/home/user/SVNREPO/conf/passwd

[users]
username=password
username2=password2

And we're done!!

To import a project
svn import . svn://192.168.0.1/projectA/trunk

Enter username and password as asked

To checkout an existing project
svn co svn://192.168.0.1/projectA/trunk projectALocal

Good day

No comments: