preload
JBoss Seam 2.1.0.CR1 Released svnant – Using SVN with ANT
Oct 11

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.

27 Responses to “Installing SubVersion on Fedora Linux”

  1. Joe Wright Says:

    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!

  2. ashish Says:

    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.

  3. Lee Chalupa Says:

    Ashish:

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

    Thanks.

    lee

  4. Ashish Kulkarni Says:

    Hi Lee,

    You are welcome.

    Cheers,

    Ashish.

  5. Hamish Says:

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

  6. Priti Says:

    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.

  7. amul Says:

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

  8. Ashish Kulkarni Says:

    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.

  9. Ashish Kulkarni Says:

    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.

  10. kenny chan Says:

    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?

  11. ashish Says:

    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.

  12. Priti Says:

    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.

  13. ashish Says:

    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.

  14. Priti Says:

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

  15. Priti Says:

    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

  16. ashish Says:

    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.

  17. Priti Says:

    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?

  18. ashish Says:

    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.

  19. Priti Says:

    Thanks
    I got it..

  20. Priti Says:

    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

  21. ashish Says:

    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.

  22. hai Says:

    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

  23. ashish Says:

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

    Regards,

    Ashish.

  24. Priti Says:

    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

  25. Priti Says:

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

  26. praveen Says:

    hi ashish,

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

    thanks,praveen

  27. ashish Says:

    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.

Leave a Reply