Posts Tagged ‘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

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

Restart Apache

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.