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.

37 Responses to “Installing SubVersion on Fedora Linux”

  • 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!

  • 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.

  • Lee Chalupa:

    Ashish:

    Thanks. I expected to have problems getting SVN and apache to work. This was a breeze.

    Thanks.

    lee

  • Hi Lee,

    You are welcome.

    Cheers,

    Ashish.

  • Hamish:

    Easy and simple to follow. Thanks for the excellent article!

  • Priti:

    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.

  • amul:

    could u tell me which linux os would be the best for Subversion.

  • 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.

  • 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.

  • 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?

  • 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.

  • Priti:

    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.

  • 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.

  • Priti:

    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..

  • Priti:

    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

  • 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.

  • Priti:

    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?

  • 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.

  • Priti:

    Thanks
    I got it..

  • Priti:

    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

  • 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.

  • hai:

    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

  • I have never tried that. So I am not sure.

    Regards,

    Ashish.

  • Priti:

    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

  • Priti:

    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..

  • praveen:

    hi ashish,

    i am unable to add group access in svnauth file please help me how to add group authentication on svn

    thanks,praveen

  • 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.

  • Hi Ashish,

    I installed SVN and restarted Apache by following your steps.
    When I accessed the url http://localhost/svn/sandbox it prompted me for Username and Password, I gave the user1 and passwordUser1 as user name and password. But it fails and again asked me for the user name and password.

    Could you tell me what would be the reasons for it ?
    I tried a lot ways removing and installing again and adding some other users etc, But still all the time it says ‘wrong credentials’. I’m using Fedora 11 and Firefox as my browser.

    With Thanks,
    Prince Francis

  • Bharat.M:

    i m fresher to linux and i want to install svn in federo 10

  • Bharat.M:

    SVN 1.4.6 version

  • Shady:

    I did all the steps you asked for but still I am getting access to /svn/ failed, reason: verification of user id not configured subversion
    can you help me out with this

  • Nizar:

    Hi all,

    I followed the instruction but when browsing the http://localhost/svn/repos I get this following error

    Could not open the requested SVN filesystem

  • Sachin Gokhale:

    Hello Ashish,

    I found this article very useful & able to install Subversion. But I am getting authorization error while connecting to server using Firefox.

    Authorization Required

    This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn’t understand how to supply the credentials required.
    Apache/2.2.4 (Fedora) Server at 192.168.102.24 Port 80

    Is it a good practice or I have to use SVN client for the same? Also, help me to resolve this problem.

    Thanks in advance.

    Sachin

  • Sachin Gokhale:

    Hello Ashish,

    Article is very usefule & able to install subversion in few minutes. I have done all steps in article. But getting authorization erro while connecting to repository.

    I have changed owner for svnauth & svnpass file to apache. I tried with tortoiseSVN client tool & web browser but not able to login to repository.

    Please help….thanks in advance.

    Sachin

  • Muhammad Umair:

    Hi Ashish,

    You are champ. Great article.

  • swapnil:

    Hi Ashish,
    I have the same problem as that of Sachin, what could be the problem? Cud you please help, Thanks in advance :-)

    Regards,
    Swapnil

  • Hardik Nagarkar:

    Awesome, i installed SVN and used it and ran it on my FC 13 Virtual Box. It worked like charm and so easy to install.

    Thanks for a tutorial.

    Regards,
    Hardik Nagarkar

Leave a Reply

*


9 − one =