Related softwares:
- Ubuntu 9.04
- Subversion 1.6.x
- Apache2
First, if you haven’t install Apache2 and Apache2-Subversion-library, you can do so by typing below:
sudo apt-get install apache2 apache2lib-svn
Then, edit the apache2-svn file in /etc/apache2/mods-available/dav_svn.conf.
Enter the following entry into the file and replace the variables with the square-bracket [xxx] with your value accordingly.
<Location [SVN_URL_PATH]> DAV svn SVNParentPath [SVN_PARENT_PATH] AuthName "[SVN_REPOSITORY_NAME]" AuthUserFile [AUTHENTICATION_FILE_PATH] Require valid-user </Location>
If you wish to have the repository URL such as http://hostname/svn, then replace the [SVN_URL_PATH] with /svn. Replaced the [SVN_PARENT_PATH] with the parent path of your Subversion repository. If you place your repository named projects in /var/www/svn_root/projects, then replace it with /var/www/svn_root. Replace the [SVN_REPOSITORY_NAME] with any name that you wish. Lastly, replace [AUTHENTICATION_FILE_PATH] with the absolute path of your authentication file, which we will create later. Let say we will create the file in /var/www/svn_root which named mypasswd. Then replace it with /var/www/svn_root/mypasswd.
To create the authentication file with a user named dhydrated, type the following:
htpasswd -c /var/www/svn_root/mypasswd dhydrated
To modify existing authentication file with a user named dhydrated, type the following:
htpasswd -m /var/www/svn_root/mypasswd dhydrated
Restart your Apache2 server by typing:
sudo /etc/init.d/apache2 restart
If everything went well, you should be able to access your repository via http://hostname/svn/projects, and a dialog box will be prompted to ask for your username and password as you put in the authentication file.