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.

![[del.icio.us]](http://www.ashishkulkarni.com/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.ashishkulkarni.com/wp-content/plugins/bookmarkify/digg.png)
![[Google]](http://www.ashishkulkarni.com/wp-content/plugins/bookmarkify/google.png)
![[LinkedIn]](http://www.ashishkulkarni.com/wp-content/plugins/bookmarkify/linkedin.png)
![[StumbleUpon]](http://www.ashishkulkarni.com/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Windows Live]](http://www.ashishkulkarni.com/wp-content/plugins/bookmarkify/windowslive.png)
![[Yahoo!]](http://www.ashishkulkarni.com/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://www.ashishkulkarni.com/wp-content/plugins/bookmarkify/email.png)
October 11th, 2008 at 2:33 pm
Hey Ashish,
I did this last weekend too. I allowed anonymous checkouts of the codebase, but required authentication for checkins. The red book has more if anyone wants to read about the Apache side of the config at: http://svnbook.red-bean.com/en/1.1/ch06s04.html
Thanks for the tutorial!
October 12th, 2008 at 10:56 am
Hey Joe,
Thanks for your comments.
Next, I am planning to write on the svnant task and look forward to your comments on that as well
.
Cheers,
Ashish.
October 26th, 2008 at 3:46 am
Ashish:
Thanks. I expected to have problems getting SVN and apache to work. This was a breeze.
Thanks.
lee
October 26th, 2008 at 11:04 pm
Hi Lee,
You are welcome.
Cheers,
Ashish.
January 5th, 2009 at 11:12 pm
Easy and simple to follow. Thanks for the excellent article!
February 2nd, 2009 at 2:21 pm
HI
I have a question can someone please clear it.
If I have svn setup on my server which is linux and My local machine is windows, can I submit my changes(like update and commit to repository on server) to the server, or will there be any problem.
February 20th, 2009 at 1:56 pm
could u tell me which linux os would be the best for Subversion.
March 4th, 2009 at 6:11 pm
Priti,
Yes, your SVN server can be on Linux and you can do checkouts and updates from a Windows PC either using Tortoise SVN or via plug-ins such as Subclipse for Eclipse.
Regards,
Ashish.
March 4th, 2009 at 6:12 pm
Amul,
The one I would suggest is either Fedora or RedHat Enterprise Linux. But thats just because I use these heavily.
Any linux should be fine.
Regards,
Ashish.
March 16th, 2009 at 12:01 am
Which Fedora version and subversion did you install? I tried fedora 10 and subversion 1.5.6 but there is a lot of installation error. Can you put up the links so that I can download the correct packages?
March 16th, 2009 at 12:11 pm
Kenny,
I have installed Subversion on Fedora 6 and 7. Never tried 10 as yet unfortunately.
“yum install subversion” and “yum install mod_dav_svn” should still work. However, do let me know if it doesn’t.
Regards,
Ashish.
March 16th, 2009 at 4:42 pm
Hi
Thanks for the reply. one more query..Do I need to be on the root to install all these, or can I be in my home directory and configure.
Iam one of the users of the linux server. I need to set up svn on server so that every one should be able to access it. Would this work if iam on my home dir and set it up.
March 17th, 2009 at 11:39 am
Hi Priti,
Yes. I believe that you don’t need root access. However, for certain actions, you need access to the apache account and in some cases, you will need to change ownership of certain files to apache user.
So although I don’t think you need root access, its still a good practice to keep your system admins in the loop.
Best Regards,
Ashish.
March 17th, 2009 at 1:54 pm
Hi Ashish
Thanks for the reply. right now I donot have any project Iam just installing and configuring subversion to apache. I guess I can do that right..?
and when I am trying to restart the server using httpd restart , it prompts – no such command. could you pls help me out in this..
March 17th, 2009 at 4:25 pm
Hi
I could start it with /etc/init.d/httpd start, staying on root.
But when I try to access it using web browser, It gives a 403 forbidden error saying :
You don’t have permission to access /svn/repos/ on this server.
Could you pls clear this one
Thanks
March 18th, 2009 at 11:58 am
Priti,
You probably need to grant access to all for that URL. That can be done by either adding access as “allow to all, deny to none” in httpd.conf file or your .htaccess file.
Regards,
Ashish.
March 18th, 2009 at 1:52 pm
Hi
Thanks for the reply again. does the project needs to be there in the repository before I open the browser and give my server addr and repos path..(bcoz i do not have a proj as of now, I need to import it from another svn trunk later)
If I grant access to all(as u told in the prev reply) , can I again create the users and authenticate paswds for them?
March 18th, 2009 at 3:23 pm
Priti,
No, the project does not need to be in the repository. For browsing, you can use either your browser or downloat Tortoise SVN and use the repository browser tool from that.
Yes, you can grant access to all, but restrict it within SVN to which users are allowed. The instructions on how to do so are on my blog.
Regards,
Ashish.
March 19th, 2009 at 1:08 pm
Thanks
I got it..
March 19th, 2009 at 2:04 pm
Hi Ashish , ihave one more question..
When I create the passwords file, it prompted for username and pwds but when i created the authorization file in which i have given read write access, it doesnt prompt me but displays the revision num etc. any clue ??
Thanks
March 20th, 2009 at 4:58 pm
Priti,
Passwords file stores the passwords and Authorization file stores details of which users have what access (read or read-write).
These are 2 separate files with 2 different purposes.
I am not sure about this revision num.
Regards,
Ashish.
April 20th, 2009 at 4:24 am
Hi Ashish,
Following your guide, I’ve configured and work well with http://localhost/svn/sandbox protocol, but now i want run under svn:// , how do i do that?
thanks
May 4th, 2009 at 12:00 pm
I have never tried that. So I am not sure.
Regards,
Ashish.
May 11th, 2009 at 2:19 pm
Hi Ashish
Question again.
Now that I have a repository and a dummy proj which has nothing in it, Now I want to create a proj and add files in it and how do I and my co workers use it..
It would be a grt help.
Thanks
May 11th, 2009 at 4:04 pm
If Iam using windows as local m/c and linux as server and not using Eclipse.
How do I see the project and work on them to commit back.
Thanks Ashish..
June 5th, 2009 at 12:43 pm
hi ashish,
i am unable to add group access in svnauth file please help me how to add group authentication on svn
thanks,praveen
June 9th, 2009 at 11:53 am
Hi Praveen,
I haven’t tried something like that myself. You may have to read the documentation of SVN for that.
Sorry mate.
Cheers,
Ashish.