|
This is the second of my four-part introductory series on Subversion (SVN). This part describes the SVN installation on both server and client sides (Part 1 http://www.cmcrossroads.com/content/view/6533/120/ gave a basic overview of Subversion history and features, Part 3 will give you the guided tour of the most frequent Subversion use cases. Finally, Part 4 will provide some hints for the process of migrating from another RCSs to Subversion). Depending on the setup required, SVN installation can be anything from trivial to a nightmare. In this article we will describe the most common setup: accessing SVN via HTTP protocol using the Apache HTTP server, which is much closer to trivial than to nightmare. We have chosen this setup, since it seems to be the most common and also it’s a basis for more advanced setups (e.g. for LDAP integration). The steps are following:
If you wish to live without Apache, then you can consult the Subversion Book or the Links section which points to some other tutorials on installing SVN with svn: protocol access. Installing Apache Subversion requires Apache 2.0.x edition (not the latest 2.2.x). The MSI installer can be downloaded from http://httpd.apache.org/download.cgi. Don't forget to choose the 2.0.x version. After downloading, start the installer and go thought the installation screens. When leaving the default values, you should end up with Apache installed as a Windows service and running on port 80. If you run some personal firewall or similar protection software, make sure to disable it so that it does not block any installation steps. Also, some communication programs, like Skype, occupy the port 80 by default, so it's safer to close them in advance. After the installation is finished, you will see the feather-like Apache status icon in the taskbar. Pointing your web browser to http://localhost/ will display Apache's welcome screen. That's all for basic Apache's installation.
Installing Subversion The 'Downloads' section at http://subversion.tigris.org/ contains the link for the user-friendly exe installer. It contains components for both client and server side. During the installation make sure to check the option to install the Apache modules. After the installation is complete, the Subversion documentation icon should appear on your desktop. It's a Windows-help version of the Subversion Book, which contains the most complete information on any topic related to Subversion. Now, if you open the console window and try to type the svn or svnadmin command you will get the help screen (if not, then you might need to restart/relogin to update your path system variable).
Configure Apache with Subversion The Subversion installation modifies your Apache configuration file to load the modules which handle the Subversion requests. Now we will finalize the configuration by pointing Apache to your SVN repository. Open the httpd.conf file (usually in "C:\Program Files\Apache Group\Apache2\conf") and add the following text to the end: DAV svn SVNParentPath C:/SVN This tells Apache that all subfolders of C:/SVN are SVN repositories which will be accessible via the /repos URL. Restart Apache for the settings to take effect (use the feather icon in your icon tray). Now, execute the following command to create the repository: c: mkdir \SVN cd \SVN svnadmin create sandbox The last command creates the new SVN repository with name sandbox. Pointing your browser to http://localhost/repos/sandbox/ will now show the content of the repository revision 0 (zero). Note that we did not have to restart the Apache to add the repository. Those, who prefer to have just one repository might use SVNPath instead of the SVNParentPath directive in httpd.conf and give the path up to the repository folder (e.g. c:/SVN/sandbox/ in our case).
Adding security Now we have the repository created and accessible, but there are no restrictions and logins required, which is something we definitely don't want. Therefore we will add some security to our repository. We start with authentication (who you are) and then proceed to authorization (what are you allowed to do). In the basic setup, the Subversion uses the password file to store the user names and their (encrypted) passwords. Change the Subversion section in httpd.conf to this DAV svn SVNParentPath C:/SVN Require valid-user # how to authenticate a user AuthType Basic AuthName "My Subversion repositories" AuthUserFile "c:/SVN/passwd" and restart Apache. The content of the passwd file is managed using the htpasswd.exe utility, which is located in Apache’s bin folder. Run this command inside the bin folder: htpasswd.exe -b -c c:\SVN\passwd tutor tutorpass to create the passwd file (-c option) and add the user 'tutor' with password 'tutorpass' (the -b option tells, that we want to specify the password as parameter). If you now point your browser to the repository URL (http://localhost/repos/sandbox/) the login window will appear asking for credentials. Failure to give valid credentials will result in "Authorization Required" error screen. Once the correct credentials are provided the browser session will remember them until it's closed, so you have to restart browser to 'logout'. Now the repository requires all users to login, but you get either all rights or none. Therefore we will add the settings to fine tune the authorization. Add the new lines to our httpd.conf file section so that it looks like this: DAV svn SVNParentPath "C:/SVN" # our access control policy AuthzSVNAccessFile "c:/SVN/access" # try anonymous access first, resort to real authentication if necessary. Satisfy Any Require valid-user# how to authenticate a user AuthType Basic AuthName "My Subversion repositories" AuthUserFile "c:/SVN/passwd" The first statement points to the access file location and "Satisfy Any" enables anonymous access (if not disabled by the access file). Don't forget to restart Apache after doing the change. Then create the access file with the following content:
# Default access for all repos [/] * = @trusted = rw # Sandbox is opened for everyone [sandbox:/] * = rw [sandbox:/serious] * = r tutor = rw
Now you can create the serious folder through the Tortoise GUI. Right-click somewhere in Windows Explorer, select TortoiseSVN->Repo-browser and enter the repository URL (http://localhost/repos/sandbox/). The repository browser will appear showing the empty repository. Right-click the root node, select 'Create folder...', enter 'serious' and then 'Creating the serious folder' as the commit message. In the next window type in the credentials (you can tell Tortoise to remember them) and voila, the new folder is created. Now right-click the root node and choose 'Show log' - you will see the information about the commit you just made.
This was the final exercise in this part of the series. You can now start playing around with your repository using TortoiseSVN or the command line clients (svn and svnadmin). The documentation which came with Subversion (remember the icon on your desktop) and TortoiseSVN can help you. Or you can wait for the next part of this Subversion series, which will bring the guided tour through the most frequent Subversion use cases. Is this all? For those, who are eager to install something more, this last section provides the brief listing of other clients and useful tools for Subversion. The following list does not aim to be complete - there are many more SVN tools available these days. It's just the selection of free tools, which I consider to be representative in some way, or which attracted my attention by some nice features. Other Clients RapidSVN - cross platform GUI client written in C++ - http://rapidsvn.tigris.org/ SmartSVN - cross platform GUI client written in Java - http://www.smartsvn.com/
IDE Integrations
Subversive - plugin for Eclipse - http://polarion.org/
Web Interfaces
Other projects Michal Dobisek is Software Architect at Polarion Software GmbH (http://polarion.com/). He has experience with CVS, Perforce and Subversion. He has two years experience in using, administering and tweaking Subversion. He holds a Masters degree in Cybernetics from Gerstner Laboratory of the Czech Technical University in Prague.
Set as favorite
Bookmark
Email this
Hits: 33802 Trackback(0)Comments (10)
|
|
... In the above article under heading "IDE Integrations", we faced problem in integration of SVN with IntelliJ that we were failed to connect SVN using "Integrated Authentication". Currently, we are able to connect SVN on IntelliJ using 'Basic Authentication' and it is working fine but due to security constrains we want to configure IntelliJ with SVN "Integrated Authentication", so can anyone help us out that how to proceed further. Thanks! |
|
PeterH_VB
said:
|
... Part 1 appears to be here: http://www.cmcrossroads.com/content/view/6533/120/ and not where this page states. Otherwise a good article for Windows. |
|
UJURR
said:
|
... We are using CVS? Is there any wrapper for converting CVS commands to SubVersion commands? For example, is there any command in subversion relevant to cvs rlog ram |
|
UJURR
said:
|
... We are using CVS as Version Control System, now trying to move to SubVersion. We have lot of tools developed for supporting CVS. Is there any wrapper available for commands of CVS?? For example, I don't find a command in subversion for CVS rlog ??? Please comment |
|
Intikhab Alam
said:
|
... hello, i am new to Subversion, now i am trying to get PART1 but that is not available on mentioned link, please email me at intikhabalam@gmail.com Thanks, Intikhab Alam 00971509208361 |
|
Randhay Vishalsingh
said:
|
... Good walkthrough. Would have been better if the dos commands and config file settings were screen shot as well. The formatting will definitely confuse many out there. |
|
sanres
said:
|
... This is really helpfull but one can have similar installation / configuration setup - proper document for Unix as well. I faced many problems while installing subversion on Unix (Solaris) and documents are not really helping much. Troubleshooting/FAQ is not documented properly. Thanks! -Sanjay |
|
callmepaul
said:
|
... This really could have been formatted better. It's a helpful article but there are a few problems, such as the lack of line breaks and font changes in your sample scripts. I thought the PDF might be formatted better but no luck. Since I am new to SVN and Apache, this is making it a bit difficult to use your article. A few more tweaks and this would be a very straightforward and helpful article. As it is, it got me started, I just needed to look elsewhere to put the pieces together. Thanks anyway, good article overall! |
|
Luis Linares
said:
|
Integration with LDAP and apache. Hello. I am trying to figure out how should I do the integration between ldap and subversion. So far.. I can validate my users against ldap... but I need to give them privilage. I need to access with some users "read and write" with others "read". Do you have any ideas ? I dont want to use a user, password file again... |
|



