This article is based on information provided by QPKG package created for SVN by noski and on QNAP Wiki article about SVN and of course a piece of my experience. But since SVN is relatively easily to install by-hand (so you don’t actually need QPKG package) and since Wiki article about SVN is outdated / contains some garbage (directory
/share does note belong to
/dev/ram!), I decided to write my own guide.
So here it is, step-by-step guide on getting SVN to your QNAP. Tested on TS-210, should work everywhere.
1. Install Optware (IPKG), if you haven’t done it yet.
If in any troubles or doubts, then this article should help.
2. Install SVN on your QNAP using IPKG.
Call (via SSH, from command-line):
ipkg install svn
Notice: wget on board many QNAPs, used by IPKG (as good as many other stuff there) is a piece of crap and sometimes ends up with some stupid errors saying that you should use
ipkg update svn instead. Don’t waste your time on reading this crap.
ipkg install svn as long as after calling
ipkg info svn you’ll see line saying:
Status: install user installed. If you see
Status: unknown ok not-installed instead, that means that SVN is not installed on your QNAP, no matter what wget or IPKG claims.
3. Create a folder called ‘svn’ or ‘SVN’ or whatever you want, inside your
Notice to use QNAP’s administration panel, to set Samba permissions, create a proper symlink, etc. Don’t get the lazy way by calling
mkdir /share/svn or you get yourself into troubles. However, if you want to put your
svn folder (where all your repos will be stored) inside some already existing share, then (and only then) using mkdir is recommended.
4. Create your first SVN repository.
Go back to console and execute:
mkdir /share/svn/repo_name svnadmin create "/share/svn/repos/repo_name"
Starting SVN… once or always!
To start SVN server on your QNAP in daemon mode, execute following command:
svnserve -d -r /share/svn
with valid path after -r parameter value.
This is the tricky part. You started your SVN daemon, but it will work only until next reboot of your QNAP (or until you kill it — see below). To have SVN accessible all time, you have to add server starting command to autorun feature of your QNAP. If you don’t know, how to do this, then refer to this article.
Notice also, that svnserve itself does not contains any shutdown option. If you even need to turn it off, you have to find its PID (using
ps | grep svn for example or similar) and kill it, using that PID.
Now, you can access your repository with any SVN client using this URL:
The only painful thing is, that everyone has access to it! And we need to do something to fix it, right? :]
Fixing users and access rights
Notice: This is a quick example on how to set users, their passwords and access rights to each repository. This is fine, if you have only one repository or multiple repositories accessed by different sets of users. If you need one, common set of users and access rights to many repositories, google around or use links in the beginning, as this goes far beyond this tutorial.
1. Go to
svnserve.conf are in your scope of interest right now.
Most Internet guides gives examples on setting passwords using htpasswd command, which is missing on pure QNAP. So, you must edit these files manually. Use your favorite editor. vi is available on your QNAP, which is for me (a Linux newbie) so extreme piece of crap. If you installed Optware / IPKG, you can use it to install Nano editor (
ipkg install nano), far more usable. You can also use a very good editor embeded into Midnight Commander, if you installed it (again, using IPKG —
ipkg install mc).
2. Set users’ logins and passwords in
passwd file .
You do this below
[users] group, putting each user into separate line and writing each line in format “login = password”, without citation marks of course. Remember, that you put plain, not encoded passwords to this file. And that you edit this file each time you want to change users, password or permissions for the repository, in which this file is kept.
Storing passwords in plain text is an obvious security leak. Seems someone forgot that. There is a way to use MD5 or any other type of encryption with SVN, but it is not an easy task. Especially, if you use your own, separate installation of SVN (it is much easier, if you use SVN preconfigured as module of Apache webserwer, where you can easily use MD5 encrypted passwords).
Google around, if you want to know how to use encrypted passwords. This article seems to be a good start.
3. Set access rights.
Finally, you have to edit
svnserve.conf in the same directory.
Basically you have to do this only once. All you have to do, is to enable (remove comment character from the beginning –
#) for lines
password-db. If you don’t want to give anonymous users any access (by default they have read-only access to this repository, after you remove trailing # character), you have to change
More details you’ll find in this file itself, as it is very good documented.
That would be generally all. Get yourself any SVN client and check, if you can access your repository and if everything else is OK.