Saturday, June 13, 2009

Setting up a local SVN server in Fedora Core

hi there......this is my first blog post. So I am not being able to decide which topic I should start with. I am going to start with a very useful topic, "Setting up a local SVN server".

SVN (Subversion) is a version control system which is used to control the changes of files maintained by many people. For example, if many developers are working on a project from different locations (or even from same location), few person can work with the same file and then save it with the changes they made to that file. SVN is a very smart tool that can identify the changes made my each developer and then updates the file in server with all the changes, with no error or bug (SVN actually changes the lines in files rather than overwriting the file). It sounds very unclear first up, but you'll get used to it and understand its concept once you start using it.

Setting up SVN locally can be very useful for a office or a group of developers, so that everyone can work with the same files without having to think about the collisions.

I am going to mention the steps to setup a local SVN server below:

1. You need to have SVN installed in your system. It is installed by default in Fedora Core. If you dont have it, then you can download it using yum.

2. go to terminal and type:

'svnadmin create svn_repo'

(you can use your preferred name instead of svn_repo), It will create a folder called svn_repo in your current directory.

3. cd to the svn_repo/conf folder:

'cd svn_repo/conf/'

4. open passwd file in text editor:

'gedit passwd'

under [users] add your username and password like this:

rafi = 123456

then save the file.

5. open svnserve.conf in text editor:

'gedit svnserve.conf'

under [general], write these:

anon-access = read
auth-access = write
password-db = passwd
realm = My First Repository

6. Go to the first directory:

'cd ../..'

7. 'svnserve -r svn_repo/ -d'

8. Now you'll have to import the files you want to keep in the svn server (e.g. the source files), if you want to import trunk folder in your local server, type:

'svn import trunk/ svn://localhost/local_trunk -m "Initial creation" '

9. You can look at the svn tree: 'svnlook tree svn_repo/'

10. copy the files to a location: 'svn checkout svn://localhost/local_trunk'

It will copy the files in local_trunk folder in your home directory

11. Now change a file in local_trunk, e.g. readme, then check status:

'svn status'

(you must be in the local_trunk folder), you'll see 'M' before readme file, 'M' means modified.

12. Commit your modification to the SVN server:

svn ci WordForge/README -m "readme modified"

-m means message, you must provide a message.

13. If you want to be updated to the latest changes made by other:

'svn up'

14. How others can access the SVN server from their computer:

being root:

svn co svn+ssh://[ip of the server]/home/[user]/svn_repo/ /[path to store in client computer]

for example:

svn co svn+ssh:// /home/ankur/Desktop/

being user:

svn co svn+ssh://user@[ip of the server]/home/[user]/wf_repo/ /[path to store in client computer]

for example:

svn co svn+ssh://Rafi@ /home/ankur/

It will ask for the password of the user of server machine.

15. Now the user from client computer can update his source by going to the directory where he stored the files, then typing:

svn up

It will update the files to the latest version.

I hope it will be usefull for you......