Monday, September 14, 2009

Setting up Subversion server on Linux (CentOS)



1. Subversion is normally installed in CentOS 5.3 but just to make sure, issue the which command in the terminal.


# which svn


/usr/bin/svn will be displayed if svn is installed


2. We then edit iptables to allow connections at port 3690.


# vi /etc/sysconfig/iptables


Then insert the following line before the line that contains "-j REJECT"


-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3690 -j ACCEPT


Then save the iptables

# service iptables save


3. Lets now create a repository

# svnadmin create PATH_TO_REPO/myrepo


4. Then edit the configuration file, svnserve.conf located within myrepo/conf directory.

# vi PATH_TO_REPO/myrepo/conf/svnserve.conf


[general]
anon-access=none
aut-access=write
password-db=passwd
realm=myproject


5. Add user logins by editing the passwd file at the same directory.


# vi PATH_TO_REPO/myrepo/conf/passwd

[users]
iamuser=iamuser1234


6. If svnserve is already running, stop it first then start it again to apply the changes we made.

# killall svnserve
# svnserve -d


If you're using TortoiseSVN in Windows, myrepo can now be accessed through

svn://192.xxx.xxx.xxx/PATH_TO_REPO/myrepo


If in case you want to access the server using the realm name e.g. svn://192.xxx.xxx.xxx/myproject, just start svnserve by

svnserve -d -r /PATH_TO_REPO/myrepo



5 comments:

  1. Great post! Thanks. I always wanted to set up SVN server but thought it was really complicated.

    ReplyDelete
  2. In step 2, "service iptables save" overwrites /etc/sysconfig/iptables. Don't do it. You will overwrite the iptables file you just edited, and lose other essential port configurations. To the author of this post: strongly recommend you remove the last part of step 2.

    ReplyDelete
  3. how to add trunk , branches and tags folder on PATH_TO_REPO/myrepo.

    ReplyDelete
  4. Hi.

    When i try to connect to my svn server it appears an error "svn: Can't connect to host '.....': Connection refused". Can you help me solve this problem.

    António

    ReplyDelete

JS-Kit Comments