Free Hosting Online for WorkStations

< Previous | Contents | Next >

3.3.2. Access via WebDAV protocol (http://)


To access the Subversion repository via WebDAV protocol, you must configure your Apache 2 web server. Add the following snippet between the <VirtualHost> and </VirtualHost> elements in /etc/apache2/ sites-available/000-default.conf, or another VirtualHost file:


<Location /svn> DAV svn

SVNParentPath /path/to/repos AuthType Basic


3 http://svnbook.red-bean.com/


AuthName "Your repository name" AuthUserFile /etc/subversion/passwd Require valid-user

</Location>


The above configuration snippet assumes that Subversion repositories are created under /path/to/ repos directory using svnadmin command and that the HTTP user has sufficent access rights to the files (see below). They can be accessible using http://hostname/svn/repos_name url.


Changing the apache configuration like the above requires to reload the service with the following command


sudo systemctl reload apache2.service


To import or commit files to your Subversion repository over HTTP, the repository should be owned by the HTTP user. In Ubuntu systems, the HTTP user is www-data. To change the ownership of the repository files enter the following command from terminal prompt:


sudo chown -R www-data:www-data /path/to/repos


By changing the ownership of repository as www-data you will not be able to import or commit files into the repository by running svn import file:/// command as any user other than www-data.


Next, you must create the /etc/subversion/passwd file that will contain user authentication details. To create a file issue the following command at a command prompt (which will create the file and add the first user):


sudo htpasswd -c /etc/subversion/passwd user_name


To add additional users omit the "-c" option as this option replaces the old file. Instead use this form:


sudo htpasswd /etc/subversion/passwd user_name


This command will prompt you to enter the password. Once you enter the password, the user is added. Now, to access the repository you can run the following command:


svn co http://servername/svn


The password is transmitted as plain text. If you are worried about password snooping, you are advised to use SSL encryption. For details, please refer next section.


Top OS Cloud Computing at OnWorks: