Setting up a Subversion server

Subversion is a code repository management system that is very similar to CVS, with some additional features that make it a more complete solution. Here’s a short list:

  • svn is able to track changes to files when they change names. CVS will break all historical information when this happens, effectively baring the ability to roll back any items when the containing folder is renamed.
  • with svn commits are implemented as atomic, transactional units of work while cvs does not. With CVS, if there is a large commit happening, and the internet connection is interrupted or something goes wrong, the repository can corrupt causing all kinds of mayhem, leaving the repo in a strange, sometimes unusable state. Not likely to happen, but not something anyone would want to spend a few hours fixing either.
  • svn supports more than just text files. CVS was designed only to support text so images, pdfs, and binary data when diff’d (compared “line by line” to detect differences) between 2 versions, the binary representation comes out all garbled looking and ends up usually a pretty useless action

If you end up upgrading to svn, you’ll need to change all your ant build scripts to make sure they use svn to build and compile, and that you update the repository information and users to the new setup. SVN uses apache and allows for a lot of coll features out of the box like being able to browse your repository from the web, much in thanks to apache because svn uses the http protocol combined with webdav to allow for file uploads, authentication, stuff like that. There is also a lot of community support as well as third party plugins for both svn and IDE platforms like eclipse and netbeanz etc.

So here’s how to set it up:

make sure subversion is installed

[root@bedrock ~]# yum install subversion
[root@bedrock ~]# yum install mod_dav_svn

create your repository

[root@bedrock ~]# mkdir /svn/repos/your_repository

create your svn repository

[root@bedrock ~]# svnadmin create /svn/repos/your_repository

set the permissions

[root@bedrock ~]# chown –R apache:apache /svn

fix the SUSElinux permissions stuff

[root@bedrock ~]# chcon -h system_u:object_r:httpd_sys_content_t /svn
[root@bedrock ~]# chcon -R -h root:object_r:httpd_sys_content_t /svn

set up the apache location configuration

[root@bedrock ~]# vi /etc/httpd/conf.d/subversion.conf

<Location /svn>
   DAV svn

   # any "/svn/repoX" URL will map to a repository /svn/repos/repoX
   SVNParentPath /svn/repos

#   Limit write permission to list of valid users.
   <LimitExcept GET PROPFIND OPTIONS REPORT>
#     Require SSL connection for password protection.
#     SSLRequireSSL

      AuthType Basic
      AuthName "Openscope SVN Repository"
      AuthUserFile /svn/authentication/passwords
      Require valid-user

#      AuthzSVNAccessFile /svn/authentication/svnauth
   </LimitExcept>
</Location>

set up the subversion users

[root@bedrock ~]# htpasswd -cb /svn/authentication/passwords user1 password1
[root@bedrock ~]# htpasswd -b /svn/authentication/passwords user2 password2

Note: the switch -c creates the password file, -b flags to batch process the password from the command line (won’t prompt the user for a password). More about how to use htpassword here.

restart the apache service

[root@bedrock ~]# service httpd restart

you should be good to go.



Related posts:

  1. Set up postgres
  2. Install mod_jk
  3. Configre Sendmail

Comments (0)

› No comments yet.

Leave a Reply

Allowed Tags - You may use these HTML tags and attributes in your comment.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Pingbacks (0)

› No pingbacks yet.