I have spent half a day on installing Subversion on my Ubuntu 14.4 server using Plesk 12.5 and ran into a few problems. So, I'm taking another 20 minutes to write them down just in case anyone out there is in need of a centralised version control.
1. Install prerequisites as usual:
apt-get install subversion libapache2-svn
2. Create a subdomain for your server. In my example I will use
/var/www/vhosts/mydomain.com/httpdocs/svn
You do not need PHP-Support or whatever, just turn it off. Please note that the subdomain data is supposed to go into a subdirectory of the main site's httpdocs but this is just my personal choice, feel free to add the directory whereever you like.
3. Set up Password protection for svn.mydomain.com/ (root directory of the webspace)
this way you can add and remove users of your repository using the Plesk interface. Add a test user.
4. Create the vhost.conf here: /var/www/vhosts/system/svn.mydomain.com/conf
Content:
---
<Location /svn>
DAV svn
SVNParentPath /var/www/vhosts/mydomain.com/httpdocs/svn
SVNListParentPath On
LimitXMLRequestBody 0
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /var/www/vhosts/system/svn.mydomain.com/pd/d..httpdocs
Require valid-user
</Location>
---
If desired copy this file to vhost_ssl.conf as well to support SSL encryption. In that case you have to install a valid certificate for svn.mydomain.com using the Plesk panel.
If you would like to allow anonymous read-only access to your repositories you can wrap the cursive lines above into
<LimitExcept GET PROPFIND OPTIONS REPORT>
and
</LimitExcept>
The example above sets up a directory for multiple repositories. It is also possible to set up a single repository by replacing SVNParentPath with SVNPath and omitting the SVNListParentPath line.
5. Recreate your apache conf-file with the command:
/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain svn.mydomain.com
Optional: Check whether there are two include directives to your vhost.conf and (optional) vhost_ssl.conf inside your httpd.conf file (same directory)
6. Create a repository named "TestRepo"
using the svnadmin command. This is a walkthrough for installing of Subversion on Plesk, so kindly refer to your svn documentation on how to do that.
IMPORTANT: You must not create a /svn/ subdirectory inside your webspace. Although the URL of the repositories includes the /svn/ (like in https://svn.mydomain.com/svn/TestRepo) the <Location /svn> in conjunction with the SVNParentPath implicitly removes the /svn/ directory from the filesystem commands.
7. At this point you can launch your web browser and navigate to:
http://svn.mydomain.com/svn/TestRepo
The web browser should identify Subversion somehow like:
Powered by Apache Subversion version 1.8.8 (r1568071).
Troubleshooting:
405 Method not allowed
You possibly have a typo in your URL and ran into an empty directory. Plesk adds an Options -Indexes to your domain(s) by default. The 405 error is the error message that you're not allowed to read this directory.
Alternatively: You might have created a /svn/ subdirectory in your webspace and placed your repositories inside. Don't. These belong into the root directory of your subdomain *but* are addressed with /svn/TestRepo in your URL.
Redirect Cycle
A very strange error that I stumbled upon. My reason: I mistakenly created a file vhosts.conf to keep the svn configuration. Please note the plural of vhost.
Permission denied
You might run into "permission denied" messages when committing changes to svn. Although Plesk suggests otherwise, the svn repository files are not handled by Plesk but by the libapache2-svn add-on. To make it short, the files need to be owned directly by the webserver, e.g. (on Ubuntu) www-data:www-data. Unfortunately the plesk repair tool will report these files as "wrong permission" and attempt to change owner on plesk repair fs --verbose. Make sure to check ownership of your svn repositories and give ownership to your web browser instead of Plesk.
20th Jul 2016 Fixed typos in fake domain names to avoid confusion
18th Jul 2016 Added information about file ownership
14th Jul 2016 Initial version
1. Install prerequisites as usual:
apt-get install subversion libapache2-svn
2. Create a subdomain for your server. In my example I will use
/var/www/vhosts/mydomain.com/httpdocs/svn
You do not need PHP-Support or whatever, just turn it off. Please note that the subdomain data is supposed to go into a subdirectory of the main site's httpdocs but this is just my personal choice, feel free to add the directory whereever you like.
3. Set up Password protection for svn.mydomain.com/ (root directory of the webspace)
this way you can add and remove users of your repository using the Plesk interface. Add a test user.
4. Create the vhost.conf here: /var/www/vhosts/system/svn.mydomain.com/conf
Content:
---
<Location /svn>
DAV svn
SVNParentPath /var/www/vhosts/mydomain.com/httpdocs/svn
SVNListParentPath On
LimitXMLRequestBody 0
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /var/www/vhosts/system/svn.mydomain.com/pd/d..httpdocs
Require valid-user
</Location>
---
If desired copy this file to vhost_ssl.conf as well to support SSL encryption. In that case you have to install a valid certificate for svn.mydomain.com using the Plesk panel.
If you would like to allow anonymous read-only access to your repositories you can wrap the cursive lines above into
<LimitExcept GET PROPFIND OPTIONS REPORT>
and
</LimitExcept>
The example above sets up a directory for multiple repositories. It is also possible to set up a single repository by replacing SVNParentPath with SVNPath and omitting the SVNListParentPath line.
5. Recreate your apache conf-file with the command:
/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain svn.mydomain.com
Optional: Check whether there are two include directives to your vhost.conf and (optional) vhost_ssl.conf inside your httpd.conf file (same directory)
6. Create a repository named "TestRepo"
using the svnadmin command. This is a walkthrough for installing of Subversion on Plesk, so kindly refer to your svn documentation on how to do that.
IMPORTANT: You must not create a /svn/ subdirectory inside your webspace. Although the URL of the repositories includes the /svn/ (like in https://svn.mydomain.com/svn/TestRepo) the <Location /svn> in conjunction with the SVNParentPath implicitly removes the /svn/ directory from the filesystem commands.
7. At this point you can launch your web browser and navigate to:
http://svn.mydomain.com/svn/TestRepo
The web browser should identify Subversion somehow like:
Powered by Apache Subversion version 1.8.8 (r1568071).
Troubleshooting:
405 Method not allowed
You possibly have a typo in your URL and ran into an empty directory. Plesk adds an Options -Indexes to your domain(s) by default. The 405 error is the error message that you're not allowed to read this directory.
Alternatively: You might have created a /svn/ subdirectory in your webspace and placed your repositories inside. Don't. These belong into the root directory of your subdomain *but* are addressed with /svn/TestRepo in your URL.
Redirect Cycle
A very strange error that I stumbled upon. My reason: I mistakenly created a file vhosts.conf to keep the svn configuration. Please note the plural of vhost.
Permission denied
You might run into "permission denied" messages when committing changes to svn. Although Plesk suggests otherwise, the svn repository files are not handled by Plesk but by the libapache2-svn add-on. To make it short, the files need to be owned directly by the webserver, e.g. (on Ubuntu) www-data:www-data. Unfortunately the plesk repair tool will report these files as "wrong permission" and attempt to change owner on plesk repair fs --verbose. Make sure to check ownership of your svn repositories and give ownership to your web browser instead of Plesk.
20th Jul 2016 Fixed typos in fake domain names to avoid confusion
18th Jul 2016 Added information about file ownership
14th Jul 2016 Initial version
Last edited: