Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] Installing MinimServer on a PowerQUICC Synology NAS
31-01-2014, 13:28 (This post was last modified: 20-02-2014 21:59 by jones.)
Post: #1
[Tutorial] Installing MinimServer on a PowerQUICC Synology NAS
[Tutorial] Installing MinimServer on a PowerQUICC Synology NAS

The tutorial "Installing the 'Java SE for Embedded' package on a Synology NAS" by winxi describes how to get Java up and running on your Synology NAS. Unfortunately, that method, and that package, is not available for those having an older PowerPC based NAS, build on the PowerQUICC CPU. Without Java, MinimServer cannot be installed, a real pity, since it is such a great piece of software - thanks Simon!
Browsing on several forums (Synology forum, PC Load Letter by patters), there is another method, quite manual, which I eventually decided on trying. I'm not a Linux expert, but also not a newbie to computers. Anyway, I managed installing Java, and getting MinimServer running on my DS410. This tutorial aims to explain the steps I took, so you can also try it. Please note that it requires logging into your NAS using the TELNET service, and changing stuff. Therefore, you are "modding" your NAS, and consequently it will waive your rights to Synology Tech support.
General Disclaimer on Modifying the Synology Server
Any damage or issue resulting from the modifications is at your own risk, I may also not be able to help you getting any of it back. Having said all that, I do believe that the described steps below should not harm your DiskStation, and the modifications can easily be undone.

Before starting, many thanks to winxi for creating a Synology package. Without it, I would not be able to install it on my DS410 and share this tutorial.
  • Step 1: Preparation
    Download the following files and store them on your NAS somewhere you can find them in a Telnet session:
    • CHROOT Debian environment: Alexander blog
    • The latest JAVA headless version for e500 PowerPC cores from the Oracle website: Oracle JAVA 7
    • The MinimServer Synology package for PowerPC: MinimServer downloads
      We will need to modify the PowerPC package content to make it work with the modified Java installation. Since the MinimServer license conditions do not allow for redistribution of the software, I cannot provide you with an already modified package. This also means you are not allowed to share your modified package with anyone else. We are allowed however to share the modification approach on this forum.

      Make sure you have Telnet functionality enabled. If you are new to a Linux command line interface (CLI), but still want to pursue this installation, I recommend you study sections 4 (subsections 1 through 4) of the Synology forum on Modifications. To make the described modifications, you will need to logon as root or admin.

  • Step 2: Creation of special environment for JAVA
    This step will create a second environment (like, but not quite, a second operating system) on your NAS. All JAVA application will run inside that second environment. The environment is entered by means of special Linux command called chroot, which changes the "/" (root) of the folder tree. Linux only allows this command to be run when logged in as root.
    • Step 2a: Installation of Debian environment
      We have to install the Debian environment with Java and follow Alexanders approach Installing Java on a NAS Synology DS210+ with a few small modifications. Login via the telnet interface and go to the folder that contains the downloaded files.

      Code:
      cp chrootgnuspe_OpenJDKPublic.tgz /volume1
      tar xzvf chrootgnuspe_OpenJDKPublic.tgz
      mv chrootgnuspe @debian
      rm chrootgnuspe_OpenJDKPublic.tgz

      Alexanders archive contains a folder called "chrootgnuspe" which contains the Debian environment. By renaming it to "@debian" it becomes a bit more readable.
      Should you check Alexanders blog, it is in French, please note Alexander's warning about translating the website content. I had no trouble though. You could try the "Hello World" test before continuing, but make sure you return to the normal enviroment with the "exit" command!
    • Step 2b: Update JAVA installation
      The included Java in Alexanders Debian environment is quite old and initially resulted in some issues, so an update is recommended. From the location where you stored the downloaded files of step 1, execute the following code (assuming the latest Java is 7u51):
      Code:
      cp ejre-7u51-fcs-b13-linux-ppc-e500v2-headless-18_dec_2013.tar.gz /volume1/@debian/usr/lib/jvm/
      cd /volume1/@debian/usr/lib/jvm
      tar xzvf ejre-7u51-fcs-b13-linux-ppc-e500v2-headless-18_dec_2013.tar.gz
      rm ejre-7u51-fcs-b13-linux-ppc-e500v2-headless-18_dec_2013.tar.gz
      rm -r java-6-openjdk/
      If there is a newer version of JAVA, you should adjust the above file names. Future updates of the JAVA package can (and should be) installed in a similar fashion.
      Note: the last rm command also removes the Java included in Alexander's Debian environment and once you do so, the 'Hello World' test does not work anymore.
    • Step 2c: Sharing folders between normal and CHROOT environment
      Since the Debian environment is run from a different "/" mounting point, some important mounting points (files and folders) are lost inside the new environment. To overcome this, a script needs to be created that temporarily mounts those at an additional point accessible from within the Debian environment. The Linux script below can just be created by copy&paste it in a text file and saving that file as "initDebChroot.sh" (make sure the extension is not txt) and after that copying it to the following folder /volume1/@debian using the Linux cp command.
      If you have more or different volumes than 'volume1' and 'volumeUSB1' you need to have accessible from the Debian environment, just add them in a similar fashion.
      Code:
      # bind below locations to share devices, processes, pids, Synology packages, locale and timezone info
      echo Sharing devices, processes, pids, Synology packages, locale and timezone info between normal and Debian environment...
      mkdir -p /opt/debian
      mount -n -o bind /volume1/@debian /opt/debian
      mkdir -p /opt/debian/dev
      mount -n -o bind /dev /opt/debian/dev
      mkdir -p /opt/debian/proc
      mount -n -o bind /proc /opt/debian/proc
      mkdir -p /opt/debian/var/run
      mount -n -o bind /var/run /opt/debian/var/run
      mkdir -p /opt/debian/var/packages
      mount -n -o bind /var/packages /opt/debian/var/packages
      mkdir -p /opt/debian/usr/share/i18n
      mount -n -o bind /usr/share/i18n /opt/debian/usr/share/i18n
      mkdir -p /opt/debian/usr/share/zoneinfo/Timezone
      mount -n -o bind /usr/share/zoneinfo/Timezone /opt/debian/usr/share/zoneinfo/Timezone

      # bind local home folders
      echo Sharing home folders between normal and Debian environment...
      mkdir -p /opt/debian/usr/local
      mount -n -o bind /usr/local /opt/debian/usr/local
      mkdir -p /opt/debian/var/services/homes
      mount -n -o bind /var/services/homes /opt/debian/var/services/homes

      # bind local volumes, typically:
      echo Sharing volume1 and volumeUSB1 between normal and Debian environment...
      mkdir -p /opt/debian/volume1
      mount -n -o bind /volume1 /opt/debian/volume1
      mkdir -p /opt/debian/volumeUSB1
      mount -n -o bind /volumeUSB1 /opt/debian/volumeUSB1

      # bind below location to 'fool' installers that Java is present on the non-CHROOTED system:
      echo Sharing Debian JAVA folder with normal environment to show installers that JAVA is present...
      mkdir -p /usr/lib/jvm
      mount -n -o bind /opt/debian/usr/lib/jvm /usr/lib/jvm

      # copy relevant setting files
      echo Copying necessary files from normal to Debian environment...
      cp /etc/passwd /opt/debian/etc/
      cp /etc/group /opt/debian/etc/
      cp /etc/synoinfo.conf /opt/debian/etc/
      cp /etc/localtime /opt/debian/etc/
      cp /etc/resolv.conf /opt/debian/etc/
      Note the "-n" option makes the mount temporary because the /etc/mtab file is not modified.
      Make sure you run the script at least one time by typing /volume1/@debian/initDebChroot.sh.
    • Step 2d: Copying settings from normal to CHROOT environment
      The Debian environment needs access to some files of the normal enviroment, for instance to have both of them share the same time and timezone. The following code copies the relevant files from the normal environment to the Debian enviroment and has been included in the above script for your convenience.
      Code:
      # copy relevant setting files
      echo Copying necessary files from normal to Debian environment...
      cp /etc/passwd /opt/debian/etc/
      cp /etc/group /opt/debian/etc/
      cp /etc/synoinfo.conf /opt/debian/etc/
      cp /etc/localtime /opt/debian/etc/
      cp /etc/resolv.conf /opt/debian/etc/
    • Step 2e: Updating default profile file
      Open the "/etc/profile" file in your favorite Linux editor, for example vi (command reference). Make sure you run this from your normal enviroment.
      • Add a line with the following (adjust if JAVA updated to a newer version): JAVA_HOME=/usr/lib/jvm/ejre1.7.0_51
      • Add a line below the previous one: export JAVA_HOME
      • Add an alias to allow you to easily initialize the Debian enviroment: initdebroot="/volume1/@debian/initDebChroot.sh"
      • Add an alias to allow you to easily enter the Debian enviroment: loaddebroot="/volume1/@debian/initDebChroot.sh; chroot /opt/debian /bin/bash"
      After saving and closing the file, you can run it with with the following command: source /etc/profile
      This is only needed once to activate the changes in the currently running session. Once "/etc/profile" is updated, it will be run automatically every login.

      With the above steps completed, your Debian environment should be ready to run your JAVA applications!
    • Step 2f: Enabling UTF-8 support
      MinimServer can use UTF-8 locale and charset, and the start-stop-status script in winxi's MinimServer Synology package for PowerPC assumes certain locations to find the relevant files. To enable this, a few more modifications need to be made:
      Code:
      mkdir -p /usr/lib/jvm/bin
      mkdir -p /usr/lib/jvm/share
      ln -s /usr/bin/locale /usr/lib/jvm/bin/locale
      ln -s /usr/bin/localedef /usr/lib/jvm/bin/localedef
      ln -s /usr/share/i18n /usr/lib/jvm/share/i18n
      The above code can be executed from any location.
  • Step 3: Modifying the MinimServer package
    As mentioned, we will need to modify the Synology PowerPC package ourselves. The MinimServer license conditions do not allow for redistribution of the software, this also means you are not allowed to share your modified package with anyone else. We are allowed however to share the modification approach on this forum.
    The below modifications will create a new package that allows you to easily install the modified package using the Synology package center. When successful, you can start and stop your MinimServer from the DiskStation DSM interface like any other installed package.
    • Step 3a: Unpacking the software
      You have already downloaded the relevant files from the MinimServer website, start by copying them to a place where you can easily modify them. You will need to access the files from Linux for unpacking, but the file modifications can also be done from any other Operating Systems (e.g. Windows). Execute the following code from the folder where you have downloaded the MinimServer packages (adjust the files name where needed for updated version):
      Code:
      mkdir -p /tmp/tmp
      mkdir -p /tmp/tmp/package
      cp MinimServer-0.8.1-ppc.spk /tmp/tmp
      cd /tmp/tmp
      tar xzvf MinimServer-0.8.1-ppc.spk
      cd /tmp/tmp/package
      tar xzvf ../package.tgz
      rm ../package.tgz
      rm ../MinimServer-0.8.1-ppc.spk
      The above code should give you the 3 files (INFO, LICENSE and package.tgz) and 2 folders (WIZARD_UIFILES, scripts, package) in the /tmp/tmp folder. Inside the /tmp/tmp/package folder you will find another 2 files (LICENSE.txt, minim.sh) and 5 folders (etc, lib, libext, libsys, ui).
    • Step 3b: Modifying the minim.sh script
      Use your favorite text editor to modify the start-up script in the package folder:
      • Make a copy of the original minim.sh file, e.g. minim.orig
      • Find line 34, starting with export and append "MINIM_HOME" "MINIM_USER" (including quotes "")
      • Find line 35 starting with: su minimserver -s
      • And replace su minimserver -s with chroot /opt/debian
      • On the same line, add " -splash:$MINIM_USER" (excluding quotes "") after "$JAVA_HOME/bin/java" (excluding quotes "")
      • On the same line, change $HOME/$APP_DATA to $MINIM_HOME/$APP_DATA
      • Insert a line before line 34 with source ${MINIM_HOME}/.profile
      Make sure you save the file!
    • Step 3c: Modifying the start-stop-status script
      Use your favorite text editor to modify the server script/start-stop-status script:
      • Find line 38 with the "source" statement
      • Insert a line below with the following "sh -c /volume1/@debian/initDebChroot.sh"
    • Step 3d: Creating a new package for PowerQUICC CPU
      The following code will create a new package file:
      Code:
      cd /tmp/tmp/package
      tar czvf ../package.tgz *
      cd ..
      rm -r package/
      tar czvf MinimServer-0.81-DS410.spk *
      You should copy or move the newly created package to a location you can access easily from the Synology web manager and where you can keep it for future installations.
  • Step 4: Installing the MinimServer package
    The SPK package file you just created can be installed onto your DiskStation via the Package Center. It will bring up a wizard to guide you through the process which also makes some rudimentary checks of your system. In case you wonder about this part, you could check out the description on the Minimserver website.
    Make sure you did NOT reboot your NAS between the installation of the package and the execution of the /volume1/@debian/initDebChroot.sh. script (step 2c). If you did reboot the NAS, you will get an error saying that JAVA is not properly installed.
    Also, you may get a message about UTF support not being available, in which case you may need to tinker around with that. If you'd like to use the MinimStreamer as well, you will need to copy the following files to the Debian environment to enable ffmpeg support. Before executing below code, you should have run the 'initDebChroot.sh' script already.
    Code:
    cp /lib/libavfilter.so.1 /opt/debian/lib
    cp /lib/libavcodec.so.52 /opt/debian/lib
    cp /lib/libavutil.so.50 /opt/debian/lib
    cp /lib/libopencore-amrwb.so.0 /opt/debian/lib
    cp /lib/libopencore-amrnb.so.0 /opt/debian/lib
    cp /lib/libmp3lame.so.0 /opt/debian/lib
    cp /lib/libfaac.so.0 /opt/debian/lib

    cp /usr/lib/libavdevice.so.52 /opt/debian/usr/lib
    cp /usr/lib/libavformat.so.52 /opt/debian/usr/lib
    cp /usr/lib/libswscale.so.0 /opt/debian/usr/lib

    Updates of MinimServer and MinimStreamer can be done through MinimWatch, please check the Minimserver website for more details.

Enjoy! And don't forget to thank Simon, for instance by making a donation. :-)

PS If you find some improvements to this tutorial, please let me know.
Find all posts by this user
Quote this message in a reply
31-01-2014, 18:55
Post: #2
RE: [Tutorial] Installing MinimServer on a PowerQUICC Synology NAS
Thanks very much for creating this tutorial and sharing it! It should be useful for other DS410 users who would like to run MinimServer.
Find all posts by this user
Quote this message in a reply
07-02-2014, 15:54
Post: #3
RE: [Tutorial] Installing MinimServer on a PowerQUICC Synology NAS
Hi, I'm using DS110+ and a newbie in Linux, followed jones hints here and step by step to build the minimserver, already passed "Hello World" test in step 2a of Debian environment, now I got errors in step 2C (Sharing folders between normal and CHROOT environment) while running the script /volume1/@debian/initDebChroot.sh, I made the script by copied text and saving as "initDebChroot.sh", here is the contents :-

# bind below locations to share devices, processes, pids, Synology packages, locale and timezone info
mkdir -p /opt/debian
mount -n -o bind /volume1/@debian /opt/debian
mkdir -p /opt/debian/dev
mount -n -o bind /dev /opt/debian/dev
mkdir -p /opt/debian/proc
mount -n -o bind /proc /opt/debian/proc
mkdir -p /opt/debian/var/run
mount -n -o bind /var/run /opt/debian/var/run
mkdir -p /opt/debian/var/packages
mount -n -o bind /var/packages /opt/debian/var/packages
mkdir -p /opt/debian/usr/share/i18n
mount -n -o bind /usr/share/i18n /opt/debian/usr/share/i18n
mkdir -p /opt/debian/usr/share/zoneinfo/Timezone
mount -n -o bind /usr/share/zoneinfo/Timezone /opt/debian/usr/share/zoneinfo/Timezone
# bind local home folders
mkdir -p /opt/debian/usr/local
mount -n -o bind /usr/local /opt/debian/usr/local
mkdir -p /opt/debian/var/services/homes
mount -n -o bind /var/services/homes /opt/debian/var/services/homes
# bind local volumes, typically:
mkdir -p /opt/debian/volume1
mount -n -o bind /volume1 /opt/debian/volume1
mkdir -p /opt/debian/volumeUSB1
mount -n -o bind /volumeUSB1 /opt/debian/volumeUSB1
# bind below location to 'fool' installers that Java is present on the non-CHROOTED system:
mkdir -p /usr/lib/jvm
mount -n -o bind /opt/debian/usr/lib/jvm /usr/lib/jvm
# copy relevant setting files
cp /etc/passwd /opt/debian/etc/
cp /etc/group /opt/debian/etc/
cp /etc/synoinfo.conf /opt/debian/etc/
cp /etc/localtime /opt/debian/etc/
cp /etc/resolv.conf /opt/debian/etc/


And here is the errors while running the script :-

NAS > /volume1/@debian/initDebChroot.sh
failed: No such file or directorys on /opt/debian/var/services/homes
': No such file or directoryn/etc/
': No such file or directoryn/etc/
': No such file or directoryn/etc/
': No such file or directoryn/etc/
cp: can't create '/opt/debian/etc/': Is a directory
NAS >

Please help, Thanks.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)