Install Zina Media Server

From SynologyWiki
Jump to: navigation, search

NOTE: As of Firmware 1141 (DSM 2.3) Synology released an updated Audio Station. The Synology Audio Station now provides many of the features available with Zina (folder browsing, media streaming etc.) plus Audio Station additionally provides full UPnP support and better management of playlists. There are still a few features Zina offers that are not available in Audio Station (mainly customisation) so Zina may still be of interest to you, but Audio Station is now an accomplished UPnP media controller, streamer and renderer.


This wiki aims to give FULL step by step instructions on how to install Zina on a Synology NAS. It is aimed at the complete novice. This page was written after installing Zina v1a3 and Zina V2a6 on a DS-207+ and CS-407 with firmware versions 0518 and 722 (the current firmware at the time of editing).

Note: Version 2.0a7 of Zina (the current version at the time of writing) is in Beta testing, but seems stable and fully functional. v2 of Zina has a different installation procedure compared to v1 as detailed below.

Contents

What is Zina

The Zina website would be your best answer to this question, but in short Zina is a FREE but capable streaming media server which can be installed on a Synology DS to enable users to stream music files (e.g. MP3) over a LAN or over the Internet. Zina is a php application and can therefore run on a Synology DS using the Web service. Zina has some advanced functionality as described on the Zina website.

Unlike the Synology Audio Station it will not play over an Audio card attached to your Synology box (you have to stream, e.g. to your laptop) but it will show you your tree of music, show album art and let you record votes.

Why might I be interested in Zina instead of other packages

Unlike many packages the installation of Zina doesn't require the installation of other packages (e.g bootstrap or ipkg). It is also very easy to install and can be TOTALLY removed if required by simply deleting the folder containing the Zina application.

Pre Installation

The following is assumed;

  • You have a Synology NAS with firmware v2.0.3 - 518 or higher (although it would most probably work on all firmwares providing the "Web Service"). At the time of this update it has worked on all firmwares upto and including the current fw839.
  • You know the IP address of your Synology NAS, from now on refered to as xxx.xxx.xxx.xxx
  • You know how to login to the Management page of your DS as "admin"
  • You have 1 hour spare to complete this wiki

Installing Zina

The instructions below need to be read carefully as they are intended to cover the installation of both Zina v1 and Zina v2. Where the procedure differs it will explicitly state what version it relates to. If the instruction does not state a version, it applies to all versions.

  1. Using an internet browser login to the Management page of your NAS and start the "Web Service". This can be found under "Network Services"
  2. Enable the Command Line Interface (Telnet or SSH)
  3. Download the zina archive file in the .tar.gz form from http://sourceforge.net/projects/zina to your computer
  4. Copy the .tar.gz file from your computer to the "web" folder on your DS. The easiest way to do this is through ftp or the "File Station" utility page of your NAS
  5. Login into the Command Line Interface as root
  6. Navigate to the web folder on your NAS, e.g. enter "cd /volume1/web"
  7. Unpack the archive file you placed in the web folder in step 4 above, e.g. enter "tar -xvzf thefilename.tar.gz"
  8. Delete the compressed file, e.g. enter "rm thefileName.tar.gz"
  9. Enter "dir" and make a note of the directory name that was created by Unpacking the archive. For Zina v2 it is simply zina. For Zina v1 the version number is part of the directory name, e.g. for v1.0rc3 the directory is "zina-1.0rc3".
  10. For installers of Zina v2 change the permission of the directory /volume1/web/zina/zina by entering the command "chmod o+w /volume1/web/zina/zina"
  11. For installers of Zina v2 (this is not a typing mistake, do this line as well) change the permission of the directory /volume1/web/zina/zina/cache by entering the command "chmod -R o+w /volume1/web/zina/zina/cache"
  12. Close the telnet or ssh session
  13. Installation of Zina is now complete.

Configuration of Zina

A) Using an internet browser browse to the file "index.php" in the zina directory you noted in step 9) above, e.g. for Zina v2 it is "http://xxx.xxx.xxx.xxx/zina/index.php, for installers of Zina v1.0rc3 it is "http://xxx.xxx.xxx.xxx/zina-1.0rc3/index.php". Note: you do not add "web" as part of the path.

B) You should now see a Zina page titled "Artists" but the icons will not be shown, and the page will be in plain black and white format. Do not worry this will be corrected in step C) below. Click the "login" button to login to Zina, on a new installation the default user name is "admin" and the password is "password". Once logged in click the "Settings" button to access the settings menu. Here you should first change the login password to a secure one.

Ci) For installers of Zina v1 to get the icons to show you need to change the path (on the Zina settings page) called "Zina Files Directory (relative path):" which will probably show "-1.0rc3/_zina". Change it to "_zina" then scroll to the bottom of the page and hit the "Update" button. All icons will now show properly.

Cii) For installers of Zina v2 to get the icons to show you need to change the path (on the Zina settings page) called "Zina Files Directory (relative path):". This parameter is near the bottom of the page. It will show "/zina". Change it to "zina" then scroll to the bottom of the page and hit the "Update" button. All icons will now show properly.

D) You should now play with other settings such as themes, picture sizes, number of picture columns, screen widths, cacheing, etc to suit your taste and needs.

How to get Zina to use the NAS's default Music folder

By default Zina v1 looks for music in a directory called "music" that was created when you unpacked the archive file, and Zina v2 in the directory "/volume1/web/zina/zina/demo". The steps below describe how to enable zina to access your music in the NAS's default music folder (normally located at /volume1/music) but if you have other volumes you may have chosen to place the music folder on another volume than volume1. This doesn't matter because as of approximately fw 914 synology use a variable "/var/services/music" to locate your music files on whichever volume you chose to store them on. Hence the instructions below use the variable "/var/services/music". If your firmware does not support this variable (approximately pre 914) you need to use the direct path of "/volume1/music" instead.

The steps below are the same for both Zina v1 and v2

You need to change the parameter "Music Directory:" at the top of the zina settings page to "/var/services/music" which is your NAS's default music folder. Then scroll to the bottom of the settings page and press the "update" button.

Now we need to change the php engines security setting to allow Zina access to your NAS's music folder (/var/services/music). By default php applications on your NAS are only allowed to access files in the "web" and "photo" folders of the NAS. The mod below adds the "music" folder to the list of allowed folders. Remember if you would like to add a subdirectory, e.g. "/var/services/music/albums" after firmware 2.1-803 it is case-sensative, meaning that there is a difference between "/var/services/music/Albums" and "/var/services/music/albums".

For Firmware prior to 1141 (before DSM 2.3)

  • Login into the Command Line Interface
  • Open the php.ini file using the vi text editor, e.g. "vi /usr/syno/etc/php.ini"
  • Find the definition line for variable open_basedir, e.g. "/open_basedir". The "/" is a comand to vi to find the following text. Hence the command will jump to the first occurence of the text in the file. The first occurence it will find is just a remark it is preceded by a ";". Press "n" to get vi to find the next occurence of the text. You should now be looking at a line that starts "open_basedir = /"...
  • You are going to modify this line and only this line. The structure of the line is that a ":" is used to seperate the various paths. You need to insert the path for /var/services/music into this line (note, if some of the existing entries in this line contain the text "/var/services" then your NAS's firmware will support the /var/services/music variable, if non of the existing entries in this line contain "/var/services" then you will need to enter "/volume1/music" instead). Change vi to insert text mode by pressing the "i" key. Use the cursor keys (right cursor key) to move along the line till the first "/" is highlighted (the one after the "=" sign. Now type "/var/services/music:". Press the escape key to quit the insert text mode. The line should now look like "open_basedir = /var/services/music:/"....etc.
  • To quit vi and save the changes type "ZZ", note they have to be capital Z's
  • Close the Telnet or SSH session
  • You now need to reboot your NAS to get it to re-read the open_basedir variable you changed above, e.g. using a web browser login in to the management page of your NAS, under "system" > "power management" you can select to reboot the NAS.
  • Repeat step A) above and all your music in the NAS's defualt music folder will be listed for you.

For Firmware 1141 (DSM 2.3) and probably beyond

With this firmware the php.ini file is constructed by a script (/usr/syno/etc.defaults/rc.d/S97apache-user.sh) and therefore it is this script that must be modified.

  • Login into the Command Line Interface
  • Open the S97apache-user.sh file using the vi text editor, e.g. "vi /usr/syno/etc.defaults/rc.d/S97apache-user.sh"
  • Find the definition line for variable open_basedir, e.g. "/open_basedir". The "/" is a comand to vi to find the following text. Hence the command will jump to the first occurence of the text in the file. The first occurence is "open_basedir="${PHPINI_DEF_BASEDIR}"" ignore this. Press "n" to get vi to find the next occurence of the text. You should now be looking at a line that is "open_basedir="${open_basedir}:`ls -ld /var/services/web | awk '{print $NF}'`""
  • You are going to modify this line and only this line. You need to insert the path for /var/services/music into this line. Change vi to insert text mode by pressing the "i" key. Use the cursor keys (right cursor key) to move along the line till the last double quote (") is highlighted. Now type ":/var/services/music". Press the escape key to quit the insert text mode. The line should now be "open_basedir="${open_basedir}:`ls -ld /var/services/web | awk '{print $NF}'`:/var/services/music""
  • To quit vi and save the changes type "ZZ", note they have to be capital Z's
  • Close the Telnet or SSH session
  • You now need to reboot your NAS to get it to re-read the open_basedir variable you changed above, e.g. using a web browser login in to the management page of your NAS, under "system" > "power management" you can select to reboot the NAS.
  • Repeat step A) above and all your music in the NAS's defualt music folder will be listed for you.

What you need to do after updating the Syno Firmware

If you update your Synology Servers Firmware and you used the above procedure to enable Zina to access your music files in "/var/services/music" (or "/volume1/music"), you will need to re-enable php to access your music files in "/volume1/music" by repeating the steps above in the section "How to get Zina to use the NAS's default Music folder".

Personal tools
Community Resources