Subversion on QNAP TS-239 Pro II

Based on the guide on the QNap wiki. This guide specifically shows how to install a subversion server on port 4000 for multiple repositories on the QNAP TS-239 Pro II.

  • Install svnserve:

    # ipkg update
    # ipkg install svn
  • Create a directory for the repositories:

    # mkdir /share/HDA_DATA/subversion
  • To create a new repository for a project, do the following:

    # svnadmin create /share/HDA_DATA/subversion/repos1

    NB: To delete a repository, just delete the directory itself.
  • Access to the repositories is set up in the repos1/conf/svnserve.conf, repos1/conf/passwd and repos1/conf/authz files. The following is a basic configuration.

svnserve.conf:
[general]
anon-access = read
auth-access = write
password-db = passwd

passwd:

[users]
svnuser= svnusersecret

authz:

[repository:/share/HDA_DATA/subversion/repos1]
svnuser = rw

  • To start the svnserve daemon on startup, we must add a command to autorun.sh.
    This file is located on the configuration ram block, sdx6, which must first be mounted. This is done in the following way on the TS-239 Pro II (for other models, see Running Your Own Application at Startup)

    # mount -t ext2 /dev/sdx6 /tmp/config

    Open autorun.sh in an editor:

    # nano /tmp/config/autorun.sh

    Add the following line, which will make sure svnserve is executed only when opt/bin has been loaded:

    (while test ! -x "/opt/bin/svnserve"; do sleep 5; done; /opt/bin/svnserve -d --listen-port=4000)&

    Finally, make sure autorun.sh is executable and unmount sdx6:

    # chmod +x /tmp/config/autorun.sh
    # umount /tmp/config
  • You can test the subversion server by doing a checkout using your favourite subversion client (e.g. TortoiseSVN). The url to check out will be something like this:
    svn://nas:4000/share/HDA_DATA/subversion/repos1

UPDATE 10/6 2019

After a QNap update, the Subversion server would no longer start. It appears that the “opt” dir symlink no longer points to the right place. The following fixed it.

In the autorun.sh file, just add the following instead of the above:

export LD_LIBRARY_PATH=/share/HDA_DATA/.qpkg/Optware/lib

(while test ! -x "/share/HDA_DATA/.qpkg/Optware/bin/svnserve"; do sleep 5; done; /share/HDA_DATA/.qpkg/Optware/bin/svnserve -d --listen-port=4000)&

 

Ampache on QNap TS-239 Pro II

  • Go to the Web Interface -> Applications -> MySQL Server -> “Enable MySQL Server” and “Enable TCP/IP Networking
  • Go to the Web Interface -> Network Services -> “Enable Web Server
  • In the “Web” directory on the QNap, create a directory called “music“.
  • Download the latest release of Ampache and extract it to this directory.
  • Open the corresponding URL in a browser (e.g. ‘http://nas/music’) and the Ampache installation page appears.
    If all requirements are met the configuration can begin.
  • Leave the default settings and enter ‘root’ in username and ‘admin’ in password, if you have not changed these.
  • This will generate a config file, which must be saved to the
    /config‘ directory of the Ampache installation.
  • Lastly, you will be asked to create a user for Ampache itself.
  • After logging into Ampache, go to the admin menu (found in the left menu) and add a catalog. This catalog should point to your music collection on the NAS.
  • Open a port in your router and forward it to the web server on the QNap (port 80 if it was not changed).
  • You are now ready to test your Ampache installation. You can go directly to the Ampache URL or if you have an iPhone you can use the free iAmpache app. One caveat with using the iAmpache app is, that it cannot play FLAC files. If you need to do this, or just want to save some bandwidth, continue with the following steps, which sets up FLAC to MP3 transcoding.
  • You will need LAME and FLAC in order to transcode the FLAC files to mp3.
    Install them as follows:
    ipkg install lame
    ipkg install flac
  • Open ampache.cfg in an editor able to display unix line ending (e.g. Notepad++) and edit the ‘transcode_cmd_flac‘ directive,
    so it looks like the following:

    transcode_cmd_flac = "/opt/bin/flac -dc %FILE% | /opt/bin/lame -rb %SAMPLE% -S - - "

  • Set ‘transcode_flac’ to ‘true’:

    transcode_flac = true
    Done!