Saturday, August 8, 2009

Setting up Subversion WebDAV on Fedora

To install subversion on Linux and make it available over Apache, I took the following steps:

Install subversion on Fedora

#yum install subversion

Install mod_dav_svn

yum install mod_dav_svn
Create the SVN Repository

mkdir /svn/repos
svnadmin create /svn/repos/sandbox
Change ownership of the folder to Apache

chown -R apache.apache /svn
Create /svn/repos/sandbox/svnauth file


[/]
user1 = rw
user2 = r

Here, user user1 will have read-write access while user user2 will have read-only access to the entire repository.
Create /svn/repos/sandbox/svnpass file

htpasswd -bcm /svn/repos/sandbox/svnpass user1 passwordUser1
htpasswd -bm /svn/repos/sandbox/svnpass user2 passwordUser2

htpasswd has the following usage

Usage:
htpasswd [-cmdpsD] passwordfile username
htpasswd -b[cmdpsD] passwordfile username password

htpasswd -n[mdps] username
htpasswd -nb[mdps] username password
-c Create a new file.
-n Don’t update file; display results on stdout.
-m Force MD5 encryption of the password.
-d Force CRYPT encryption of the password (default).
-p Do not encrypt the password (plaintext).
-s Force SHA encryption of the password.
-b Use the password from the command line rather than prompting for it.
-D Delete the specified user.
On Windows, NetWare and TPF systems the ‘-m’ flag is used by default.
On all other systems, the ‘-p’ flag will probably not work.
Add the following to your apache config file


DAV svn
SVNPath /svn/repos/sandbox
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /svn/repos/sandbox/svnpass
Require valid-user
AuthzSVNAccessFile /svn/repos/sandbox/svnauth

Restart Apache

#service httpd restart

Now you can access the above repository using your browser. Simply visit http://www.yourserver.com/svn/sandbox. You will be asked for username and password. Use one of the user names and passwords you used above. For example, user1 and passwordUser1.

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Did you checked http://amiworks.co.in/talk/ads-automatic-deployment-script/
    This may help you.
    I will soon post the implementation once I work out on linux.

    ReplyDelete
  3. Guys,

    Do remember that Apache Configuration is under /etc/httpd/conf.d/subversion.conf

    ReplyDelete
  4. hi buddy is this stpes for webserver?

    ReplyDelete
  5. hi man can i cannot find /etc/httpd/conf.d/subversion.conf
    what can i retrive the conf file?

    ReplyDelete