This guide assumes, that you have
svn already installed on your QNAP, fully configured and working like a charm, and you just want to enhance it with web client (WebSVN). You can use this guide also on any other server, than QNAP, but keep in mind, that it contains some QNAP-specific problems.
Keep in mind: WebSVN (as good as all other alternatives mentioned in the end of this text) are read-only web SVN clients! You can do a lot of useful stuff on your repos, but forget about committing or anything similar that requires write access or changing repository structure.
Follow these steps:
1. Get newest (though quite old) version of WebSVN from websvn.info page.
2. Unzip it and copy it (over FTP) to your QNAP. Place it in any web-accessible directory of your choice.
include/config.php and edit it. Remember about Linux-like line endings (use proper editor, not Notepad!).
4. Uncomment line starting with
$config->setSVNCommandPath and change it to
5. Uncomment line:
$config->addRepository('DisplayName', 'URL to repository (e.g. file:///c:/svn/proj)');
and change it properly, giving your correct repository name and absolute path (remember about
file:/// prefix!), i.e.:
config.php file and copy it to
include sub-folder of WebSVN instalation on your QNAP.
Note: Change in point 4 isn't mentioned in any WebSVN installation guide, that I know (except Synology and QNAP), so I assume, that it is required on NAS-like servers only, not on pure-Linux machines.
Refresh WebSVN page to see, if it is working or if you need to deal with additional errors or problems.
Configuration file itself is heavily documented, so spare some time to read through it, as you may find many interesting things or alternative approaches to solving some problems.
Config dir problem
WebSVN stores some configuration in temporary file:
/tmp/config. At QNAP (and Synology or other NAS) you may reach error saying:
Error running this command: /opt/bin/svn --config-dir /tmp --version svn: E000021: Can't read file '/tmp/config': Is a directory
If this happens, login to your NAS via SSH and execute following command set:
cd / cd tmp rmdir config
Refresh page and error should be gone.
In most cases you'll have more than just one repository, that you want to web-access using WebSVN. Here is, how to get it.
Configuration file includes a lot of comments, but they seems to be wrong. It is written there, that you should use this config switch:
to gain easily switchable access through WebSVN to all repositories in
Now, I have no bloody idea, what went wrong, but when I used this option, all I got was access to one (first when sorting alphabetically directory contents) repository. So, all that left, was to use second approach of adding each repository manually -- see point 5 in "Step-by-step guide" above.
You can use third parameter of
$config->addRepository method to group your repos. I.e.:
$config->addRepository('One', 'file:////share/Subversion/work/one/repo', 'work'); $config->addRepository('Two', 'file:////share/Subversion/work/two/repo', 'work'); $config->addRepository('One', 'file:////share/Subversion/home/one/repo', 'home'); $config->addRepository('Two', 'file:////share/Subversion/home/two/repo', 'home');
They'll appear as:
work.One work.Two home.One home.Two
It was the only way, that worked for me, to get access to more than one repository.
Always take a look at your current URL to avoid stupid and stressing mistakes. If you have only one repository, WebSVN will always redirect its home (root) URL to this repo (i.e.
http://yourhost.com/websvn/listing.php?repname=reponame). If you change your configuration to have more than one repository, this become invalid, so hitting
F5 to refresh page and see configuration change result lead to strange errors saying something about missing repo. To avoid them, always keep in mind to use root URL (i.e.
http://yourhost.com/websvn/) each time you change WebSVN configuration.
WebSVN works like a charm with local repositories, but it may also work (slower) with remote one. To add such, use above method, expanding it with two more parameters -- login and password:
$config->addRepository('DisplayName', 'http://yourhost.com/repo', null, 'username', 'password');
You may, of course, replace
'groupname', if you wish to group remote repositories a well.
The Synology Wiki article on installing WebSVN may be helpful at some points, but keep in mind, that it is written for Synology, not QNAP, so some points should be avoided and some done different.
Other articles and sources about WebSVN and/or other methods of web-accessing your SVN repos:
- Install Subversion with Web Access on Ubuntu,
- Enable HTTP and HTTPS access for Subversion,
- How To Configure Web Access To Subversion Repositories Using Apache,
- httpd, the Apache HTTP server -- Chapter 6. Server Configuration,
- Setting up Subversion and websvn on Debian.
There are other visual (web) clients for accessing SVN repositories. Namely (all read-only as well):
I decided to use it, because:
- it was very easily to install on QNAP (nearly out-of-the-box, with some changes mentioned above),
- it was produced by people who are behind TortoiseSVN, which I use on my Windows,
- it came with handy code coloring and quick links to PHP commands (small, but very useful as for me).
Aesthetic issues (point b) like having the same icons in both Windows and web access are quite important to me. You may laugh now! :]
I certainly dropped the idea of using heavy tools like Trac. Trac itself is a project management software, so it contains many extra things, that I don't need, as we speak of web accessing SVN repository. Plus, it is limited to only one SVN repository per installation. Having twenty different installations of Trac for all my twenty SVN repos wasn't something that would let me sleep well at night.
For more information about these, take a look at great article „Comparison: Subversion Web Access Apps” published at geekswithblogs.net.