1. Locate the correct version of JRE Here and download to the Public share
2. Download and install the JRE 6 QPKG for ARM or x86 from the link provided below.
ARM x19: Download Here
x86: Download Here
3. Once installed, enable it from the admin backend and that's it. You can now run any types of Java apps on your NAS now but expect the performance degrades as it is NAS and not a server/pc.
4. Download and install the Serviio QPKG.
The biggest issues is that basically you can't change any base config in for example/etc/init.d/ folders and whatnot, cause the QNAP NAS will overwrite most of it with its built-in settings (probably wise to avoid support issues where people have bricked their NAS or something by scewing up the OS )
1. Start by installing IPKG Optware from the appliaction services/qpkg plugins page (also make sure to enable it) from the QNAP web administration frontend.
2. Also set up the web server and install the serviio web frontend (i used v 0.5.2.1b), some things dont work, like setting what categories to show.
3. use for eample putty and login to the server.
4. make a tmp dir in /opt/tmp
mkdir /opt/tmp
5. From Here get the Java embedded runtime.
6. Put the file somewhere on your NAS and copy it to the temp folder
cp /share/MyStuff/Filenameyoujustdownloaded /opt/tmp
7. Download some required files in this new folder
cd /opt/tmp wget http://download.serviio.org/releases/serviio-0.5.2-linux.tar.gz wget http://download.serviio.org/opensource/ffmpeg-26303.tar.gz
8. Extract all the .tar.gz files in this folder with the command
tar xvzf filename.tar.gz
9. Install some required components through the Optware package manager, also install nano since its a better text editor than vi
ipkg install optware-devel ipkg install lame ipkg install nano
10. Put some stuff in better places
mv serviio-0.5.2 /opt/serviio mkdir /opt/java mv ejre1.6.0_21 /opt/java/
11. Now its time to compile ffmpeg, i had to edit the config file to be able to run it on my QNAP NAS, there was some command that constantly failed (mktemp), I used the suggestion in this thread to resolve it http://stackoverflow.com/questions/4581 … ure-script
so
nano /opt/tmp/ffmpeg/configure
and make the neccesary changes according to the thread above, and incase it dies, change the line
if ! check_cmd type mktemp; then
to
if true; then
after you done that, its time to compile ffmpeg
cd /opt/tmp/ffmpeg ./configure --arch=arm --enable-armv5te --prefix=/opt --extra-cflags='-I/opt/include' --extra-ldflags='-L/opt/lib' --enable- static --disable-shared --disable-ffplay --disable-ffserver --enable-libmp3lame make make install
Note that both configure and make take a long time to complete (like several minutes for configure and up to 20-30 minutes for make), make also shows some warnings, but its nothing to worry about, just sloppy coders
12. When that is done, you should be able to test if ffmpeg is correctly installed:
cd /opt/bin ffmpeg
this should hopefully generate an error that libmp3lame.so.0 could not be found (atleast it did for me), we will resolve this shortly.
You could also try to move out of the folder /opt/bin and run ffmpeg, this should hopefully launch the old ffmpeg included on the NAS for twonkymedia. You can see that the old ones build date/time is not just today (since you just compiled the new one). The text –enable-libmp3lame should also not be present in what ffmpeg prints out when you run it if it is the old one already on the NAS.
13. Now its time for some configuration
nano /opt/Optware.sh
find the line below
# adding Ipkg apps into system path ...
and replace the two lines just below it with the following
/bin/cat /etc/profile | /bin/grep "PATH" | /bin/grep "/opt/bin" 1>>/dev/null 2>>/dev/null [ $? -ne 0 ] && /bin/echo "export PATH=/opt/bin:/opt/sbin:/opt/java/ejre1.6.0_21/bin:\$PATH" >> /etc/profile
This is to resolve a bug where the paths are added in the wrong order, refer to http://wiki.qnap.com/wiki/Install_Optwa … .2Fprofile for an explanation of why. as you can see above, we also add the path to java above, so it is not exactly the same as in the link.
Also add the init script execution fix from the wiki link just below the two changed lines:
# Patch per http://wiki.qnap.com/wiki/Install_Optware_IPKG
/bin/echo "Run Optware/ipkg /opt/etc/init.d/*" source /etc/profile # Start all init scripts in /opt/etc/init.d # executing them in numerical order. # for i in /opt/etc/init.d/S??* ;do # Ignore dangling symlinks (if any). #[ ! -f "$i" ] && continue case "$i" in *.sh) # Source shell script for speed. ( trap - INT QUIT TSTP set start . $i ) ;; *) # No sh extension, so fork subprocess. $i start ;; esac done # End patch
14. Make a few config files in /opt/etc/init.d for serviio and ffmpeg (stupid names, i have no idea if the Sxx makes any difference whatsoever, but mine are named that and they are working so..)
nano /opt/etc/init.d/S95misc.sh
add the following to the file
#!/bin/sh ldconfig /opt/lib export JAVA_HOME=/opt/java/ejre1.6.0_21
The ldconfig is so ffmpeg can find libmp3lame.so.0 later on, i also try in vain to create a environment variable for JAVA_HOME, but that will not work, dont worry though, its not needed.
Create the serviio daemon script
nano /opt/etc/init.d/S99serviio.sh
add the following to the file
#!/bin/sh case "$1" in stop) echo "Stop Serviio..." "/opt/serviio/bin/serviio.sh -stop" > /dev/null 2>&1 & ;; start) # start Serviio in background mode "/opt/serviio/bin/serviio.sh" > /dev/null 2>&1 & echo "Start Serviio..." ;; restart) $0 stop sleep 1 $0 start ;; *) echo "usage: $0 { start | stop | restart}" >&2 exit 1 ;; esac
Also make both files executable
chmod +x /opt/etc/init.d/S95misc.sh chmod +x /opt/etc/init.d/S99serviio.sh
15. Almost there now. Edit the serviio start file
nano /opt/serviio/bin/serviio.sh
Just before the last line of that file (that start the server), add the following
LANG=en_US.UTF-8 export LANG
I had to place that there, even tho the system has utf8 already set, serviio would ignore that and use US-ASCII anyways, if you put it there, serviio will run on UTF8 and hopefully be able to handle special characters (mine did atleast)
Also, on the very last line of this file, there is the actual command to start the server, at the end of this line, add a space and the character & so it reads something like below
"$JAVA" -Xmx384M $JAVA_OPTS -classpath "$SERVIIO_CLASS_PATH" org.serviio.MediaServer "$@" &
That will make serviio actually run in the background on startup should you ever want to start it manually instead of on system start (the start script in /opt/init.d *should* already take care of this during system startup)
16. Reboot the system
reboot
17. Now hopefully everything should work, once the NAS is up, try logging in to with with putty and run ps, it should generate a list of processes with a line similar to the one below in there somewhere (the actual numbers will vary ofcourse)
Code: 4168 admin 56036 S java -Xmx384M -Djava.net.preferIPv4Stack=true
This means serviio is running, you should be able to check the configuration fromtend by surfing to wherever you put that in step 2
also, try to run ffmpeg, the output should be something similar to below:
[/opt/etc/init.d] # ffmpeg FFmpeg version UNKNOWN, Copyright (c) 2000-2011 the FFmpeg developers built on Apr 13 2011 20:14:18 with gcc 4.2.3 configuration: --arch=arm --enable-armv5te --prefix=/opt --extra-cflags=-I/opt/include --extra-ldflags=-L/opt/lib --enable- static --disable-shared --disable-ffplay --disable-ffserver --enable-libmp3lame libavutil 50.36. 0 / 50.36. 0 libavcore 0.16. 0 / 0.16. 0 libavcodec 52.108. 0 / 52.108. 0 libavformat 52.92. 0 / 52.92. 0 libavdevice 52. 2. 3 / 52. 2. 3 libavfilter 1.72. 0 / 1.72. 0 libswscale 0.12. 0 / 0.12. 0 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}... Use -h to get full help or, even better, run 'man ffmpeg'