View Single Post
  #46  
Old 17.10.2014, 21:44
J-J
Guest
 
Posts: n/a
Default How to install JDownloader2 on Synology NAS

HOW TO INSTALL JDOWNLOADER2 ON SYNOLOGY NAS:

  1. Install JD on Windows/Linux/OS X with the JAR-installer
  2. Start JD and let it update to the latest version
  3. Setup all settings in JD (don't forget to login to your my.jdownloader.org account)
    • User Interface
      • Enable Silent Mode
    • Bubble Notify
      • Show Bubbles if Never
    • Tray Icon
      • Uncheck Enabled
    More info on 1st post if needed (long version until step 1.3):
    Spoiler:
    Quote:
    Originally Posted by Enqueue90 View Post
    GhostAWT is no longer needed in order to run headless, Please read this post **External links are only visible to Support Staff**... for more information. -raztoki

    Introduction
    The last few weeks I did some development to make JDownloader run on server and NAS systems which do not have any XServer installed. This HowTo will explain how you can get JDownloader running without Graphical User Interface.

    Short Version (for pro users)
    1. Copy an existing JDownloader2 installation from a desktop system to your server system or NAS. Be sure to setup My.JDownloader before copying the files.
    2. Add GhostAWT to your JDownloader installation using the following commands (check "**External links are only visible to Support Staff** for the latest release)
      Code:
      cd /tmp
      wget https://github.com/Danielku15/GhostAWT/archive/0.0.1.tar.gz
      tar xzfv 0.0.1.tar.gz
      mkdir /path/to/jdownloader2/libs/ghostawt
      cp -r GhostAWT-0.0.1/dist/* /path/to/jdownloader2/libs/ghostawt
    3. Start JDownloader using this command (adjust linux32 to match your platform).
      Code:
      java -Dghostawt.library.path=libs/ghostawt/linux32 -cp "./*:libs/*:libs/ghostawt/*" ghostawt.GhostRunner org.jdownloader.startup.Main
    4. Log into My.JDownloader and adjust the download folder there.
    5. Start Downloading.

    Long Version (for average users)

    1. Create JDownloader Package

    1.1 Get Package
    As a first step we need to build a JDownloader2 package for our system. Currently JDownloader2 is only available as special offline installer packages. The problem: This installer might not run on server systems without a UI and it’s only available for x86/x64 systems.
    **External links are only visible to Support Staff**...
    For me the offline installer worked on an Ubuntu 32bit Server installation, but it didn’t work on my Synology NAS. To keep this HowTo simple, I will describe another solution:

    Simply install JDownloader on your normal desktop PC by grabbing the JDownloader2 installer from the link above.

    1.2 Configure Package
    Start JDownloader on your desktop and let it update to the latest version. Since we won’t have a UI on our server system we should configure our JDownloader on our desktop. Open the settings and configure it the way you like. Here are some recommended settings for server systems:
    • User Interface
      • Enable Silent Mode
    • Bubble Notify
      • Show Bubbles if Never
    • Tray Icon
      • Uncheck Enabled

    The most important thing is to setup your My.JDownloader settings. It will be the only way to control JDownloader.

    1.3 Copy Package
    Once your JDownloader is ready go into your JDownloader installation directory and copy all files to your server system. Do not copy the JRE directory, we won’t use the Java Runtime installed with JDownloader.

    2. Run JDownloader using GhostAWT

    Now we need to get JDownloader running on our environment. The problem is: If we start JDownloader normally, it will just crash because there’s no GUI. This is where GhostAWT comes in place. It’s a platform implementation of AWT and Java2D which makes Java believe there’s a UI available. If Java tries to create a window or do any graphical operations, GhostAWT will simply do nothing instead of crying no XServer is installed.

    Let’s download GhostAWT and copy it into JDownloader. Head to "**External links are only visible to Support Staff** and copy the link of the latest Source code tar.gz. On our server system we download the file, extract it, and copy the files of the dist directory to our JDownloader installation:

    Code:
    cd /tmp
    wget https://github.com/Danielku15/GhostAWT/archive/0.0.1.tar.gz
    tar xzfv 0.0.1.tar.gz
    mkdir /path/to/jdownloader2/libs/ghostawt
    cp -r GhostAWT-0.0.1/dist/* /path/to/jdownloader2/libs/ghostawt
    The command to start JDownloader using GhostAWT is:

    Code:
    java -Dghostawt.library.path=libs/ghostawt/synology-marvell-armada-370 -cp "./*:libs/*:libs/ghostawt/*" ghostawt.GhostRunner org.jdownloader.startup.Main
    Replace synology-marvell-armada-370 with the correct platform of your system. I recommend to create a new shell script with this startup command.
    In the first release of GhostAWT x86 linux systems (linux32) and Synology Marvell Armada 370 ARM (synology-marvell-armada-370) are available. If GhostAWT does not support your platform you should try compiling it for your platform on your own or create a new issue on "**External links are only visible to Support Staff**

    3. My.JDownloader Settings
    After starting JDownloader you should able to log in into My.JDownloader and see the connected device there. Before downloading any files you should go to the settings tab and open the „Advanced Config“.

    There enter „Default Download Folder“ into the search box and set adjust the path to match your desired download location. I copied my Windows installation to my Synology Diskstation, that’s why a Windows File System Path was set. Make it fit your needs.

    Enter „Browser Command Line“ into into the search box and click reset there. I also had some Windows specific stuff there.

    4. Fin
    Everything is done and ready for downloading. Enjoy your server/NAS JDownloader. If you encounter any problems feel free to ask here.
  4. Close JD completely
  5. Copy the content of the JD installation folder to your preferred JD installation folder on your NAS with an SSH client.
    e.g.: /volume1/@appstore/jdownloader/
  6. See that all files in this folder have the right permissions
    I first created the shared folder "jdownloader" in DSM and before restarting my NAS (step 10), I copied the content of the folder to a new jdownloader folder at "/volume1/@appstore/jdownloader/". Just to be sure I had all right to the folder

    If you're having trouble with permissions, this is how permissions are set in my jdownloader folder:
    Spoiler:


  7. Install Java Manager through Package Center
  8. Make a file called S99jdownloader.sh and save it to /usr/local/etc/rc.d/S99jdownloader.sh (with SSH client)
  9. Open S99jdownloader.sh with your text editor and copy following script into it.
    Knowing your JD install folder is at /volume1/@appstore/jdownloader/ Otherwise adjust your location in the script (line 10)
    I used the text editor of DSM to create the file and copied it afterwards with my SSH client (to have the right permissions)
    Spoiler:
    PHP Code:
    #!/bin/sh):
    #
    # Startup script for jdownloader2
    #
    # Stop myself if running
    PIDFILE=/var/run/S99jdownloader.pid
    #
    start() {
    sleep 1
    nohup 
    /volume1/@appstore/JavaManager/Java/bin/java -Djava.awt.headless=true -jar [b][color=red]/volume1/@appstore/jdownloader/JDownloader.jar[/color][/b] &
    # write pidfile
    echo $! > $PIDFILE
    }
    #
    stop() {
    [ -
    ${PIDFILE} ] && kill `cat ${PIDFILE}`
    # remove pidfile
    rm -f $PIDFILE 
    }
    #
    case "$1" in
    start
    )
    start
    ;;
    stop)
    stop
    ;;
    restart)
    stop
    sleep 1
    start
    ;;
    *)
    echo 
    "Usage: $0 (start|stop|restart)"
    exit 1
    ;;
    esac
    # End 
  10. Restart your NAS. JDownloader will now automatically be loaded at startup.
  11. Adjust settings at my.jdownloader.org under "Settings", "Advanced Settings", "General - Default Download Folder": DOWNLOAD FOLDER OF YOUR CHOISE (make sure you created this share on your NAS).
    e.g.: /volume1/Downloads

Images of JDownloader2 working on DS412+:
Spoiler:

Some Remarks
  1. Whenever there's an update of JDownloader2 you get a pop-up at my.jdownloader.org. You can trigger the update in the settings tab on the site.
  2. If JD failes to restart after an update, do the following:
    • Open DSM web interface
    • Go to "Control Panel" and then "Task Scheduler"
      Spoiler:
    • Click "Create" and choose "User-defined scripts"
      Spoiler:
    • Give the task a name (e.g. Jdownloader), set the user to "root" and as User-defined script you set /usr/local/etc/rc.d/S99jdownloader.sh
      Spoiler:
    • Close with OK
    • Unthick the script (we just want to activate it manually and not on schedule) and select the created task and click on "Run"
      Spoiler:
    • JDownloader2 should be running again (check on my.jdownloader.org)
    • Now, each time JD failes to (re)start you can launch it manually with task scheduler.


ENJOY!

Last edited by J-J; 03.06.2015 at 01:39.
Reply With Quote