(Tutorial) JDownloader in a Jail

einsargen

Cadet
Joined
Apr 30, 2020
Messages
5
if i execute this java -jar instruction JDownloader.jar -norestart it works again ... but I don't see it in the script
 

CarlDx

Cadet
Joined
Sep 2, 2021
Messages
1
First of all, thank you very much to the threadstarter for the short but directly instructions. I've made my on suggestions and want to add some extra notes for the "others", who had also some startup problems with the guide.

Second, i use the atm last stable FreeNAS build: FreeNAS-11.1-U1.iso (01/23/2018)

And third...if you see some strange smilies, which don't make any sense, the they are "translated" from this FreeNAS forum editor ;-)
Let's start

I'll copy the first and first script post (i hope you forgive me :) ) to add my special notes:


### 1st ###
Register yourself
I think it's that easy so i don't have to add something. Just one thing: use a mailadress you have permanently access to.

### 2nd ###
Create a new jail
Well, this wasn't that easy i thought, because i had a lot of to read to understand what a jail (german: Gefängnis) is. For short: a jail is something like a micro virtual machine (you don't need to download something, all you need comes with free nas by itself). Click "jail/add jail", name it and click on OK. FreeNAS will download some stuff and configure by it's own. You have the possibility to switch to the advanced mode. A jail has it own ip address, like a virtual machine. You will need it to connect with windows explorer or putty/ssh. The ip address is chosen by your default ip pool. If your network ip starts with 192.168.x.x, then the ip address will be 192.168.x.1 (for the second jail, if you want some, the ip will be 192.168.x.2 and so on). If you only want one jail, don't start to waste time with the jail template, click on advanced mode and set the ipv4 address (nothing else!!!) to that ip address you want to use. If you like to add 10 or even more jails, then you should set up your own (!) default template for jails by clicking on "jails/add jails template", type in your network configuration you like to use, save and THEN click on add jails. And yes, it's hardly recommened to use a fixed ip address until you have no or less knowledge about dns.

You should'nt mount the jail in the system harddisk where FreeNAS runs. It's even better to run a jail on a not-system-harddisk to guarantee, that the one and only FreeNAS runs on that harddisk. If you plan to take a big fat ssd for FreeNAS, don't be stupid and take the a 512gb ssd, a 32gb is more than enough! Each additional software you want to install, which don't comes with FreeNAS, you should only install in a jail, or vm!

I digress....

### 3rd a) ###
pkg update, pkg upgrade
This you already do IN THE JAIL!!! So now we have to know, how we can connect to the jail-machine. The imo easiest way is, to open up the console on your NAS (copy paste does'nt work until you're connected with something like putty > if you don't know what putty is, don't waste time to search in google, and if you know what it is, then use it with ssh > you have to modify the startup conf, so that sshd automatically start)

service sshd restart
to start it once

vi /etc/rc.conf
to modify the FreeBSD (jail is linux os > freebsd) startup script
if vim is available, use vim instead of vi

sshd_enable="NO"
change this to "YES", save and quit :)wq! + hit enter) to save the config

passwd
to set your root account a wise chosen password BUT not to complex, you will thank me later ;-)
It is hardly recommened to use another user for JDownloader which can also have root-rights but should not be root as itself, just for security reason. If you paranoid, you can also type in very hard an complex passwords and take care of all your permissions, but for noobs, skip this part even you don't know what you do.

restart your jail with the buttons on the buttom in your freenas jail configuration window

After reboot, you can use putty to connect to your jail.

### 3rd b) ###
Ok, you are root and you have your console from jail in front of you.
pkg update
Let it run through, if you have a weak broadband connection, let it be, it will finish in a few minutes.

pkg upgrade
Let it run through, if you have a weak performance, let it be, it will finish in a few minutes.[/code]

### 4th a) ###
pkg install wget openjdk8

Just type this command in, hit enter and let it be, it will finish in a few minutes. Just remember, if there comes a new jdk version, this command could vary e.g.

pkg install wget openjdk8a or pkg install wget openjdk8.1 or pkg install wget openjdk9 and so on.
If you get a promt with [y/N], always hit "y" and enter. This will install java in your jail in the given version.

### 4th b) ### (not from starting post)
cd /usr/ports/misc/compat9x/ && make install clean
pkg install compat9x-amd64


https://forums.freenas.org/index.php?threads/tutorial-jdownloader-in-a-jail.48374/#post-402618
https://forums.freenas.org/index.php?threads/tutorial-jdownloader-in-a-jail.48374/#post-402982

Thanks to fkuehne and Psychoteur because they answered the "why the f*ck won't JDownloader extract anything". While in the JDownloader FAQ you will find something like



it's much easier. Just write down both commands. I did this AFTER i installed JDownloader, and had to restart it, but if you install compat9x before the installation, i don't have to restart anything. One thing could happen: JDownloader is installed, you are already logged in and enable the archive extractor right now (after installation it is disabled), then it could be, you have to enable the archive extractor, restart JDownloader and only then, the archive extractor will work. Bug? Feature? Whatever...

### 5th ###
wget http://installer.jdownloader.org/JDownloader.jar

This will download (not install!) JDownloader in the given version (always the last version which is available on jdownloader.org)

### 6th ###
java -jar JDownloader.jar -norestart

This will install JDownloader. If you want to modify the installation path, normally it's the home directory of your logged on user. At this point i should say, if you have no no no linux knowledge and only want to run JDownloader on FreeNAS, then take a book and read it. If you have no knowledge about linux and want to understand how it works, take a linux beginner guide, read it, use it and if you are a pro, i don't to have to say anything.

### 7th ###
execute the last command more times until console asks for MyJDownloader login email/pwd (the one you created at the start)

No, you don't have to. Take a cup of coffee, do some work...do anything but wait about two three five ten minutes (depending how fast your NAS hardware is). I have a Samsung SSD 850 Pro 128GB built in, so i only wait about 2 minutes. After that, i hit the command again, and tadaaaa, you will be asked for your my.downloader.org credentials.
Type in your mailaddress, hit enter, type in your password you set with that my-jdownloader-account and hit enter.

Notice: You don't see the password you type in so type it slowly but correct.

### 8th ###
sign in at https://my.jdownloader.org and control your NAS JD

Yes, you do. But configuration isn't finished yet. This was the big first part of JDownloader installation. But if you want to close jdownloader (with the webui) or reboot your jail, jdownloader WILL NOT automatically start after reboot. So you have two options. Start it manually or make a startup script, so that jdownloader will start automatically when you restart your jail. Trust me, you would like it.

################################################################

Note: The original script from "brumnas" is a bit outdated, some paths have changed so, thank you brumnas for your script, i have to modify it.
orig. post: https://forums.freenas.org/index.php?threads/tutorial-jdownloader-in-a-jail.48374/#post-345343

Open your favorite editor in your jail (with root rights), paste the code below in (if you have putty or another terminal which support copy/paste, if you have only the console from FreeNAS, copy/paste will not work, so you have to type it char for char), save and quit and set the execute rights, otherwise the script won't work.

1.) vi /etc/rc.d/jdstart
(you could also type in "cd /etc/rc.d && touch jdstart && vi jdstart"
but i think this method is a way easier.
2.) paste the code in this file
3.) :wq! (save, quit)
4.) chmod 555 jdstart (to make jdstart for owner, groups and others executable)
5.) try your script: ./jdstart start
6.) wait a few seconds and then try to login with your my.downloader.org webUI
7.) if all works fine, close jdownloader with your webUI, restart your jail and wait....
if you have everything done right, you can login within a few seconds/minutes
in your webUI again, without starting JDownloader by your own[/code]

Code:
#!/bin/sh
###################################
# just a little bit advertisement :D
# JDownloader Startup Script by 'brumnas'
# modified by pseiko000
#
# --- placeholder ---
###################################
. /etc/rc.subr
#
name="spustit"
start_cmd="${name}_start"
stop_cmd=":"
#
spustit_start()
{
        umask 000
        /usr/local/bin/java -Djava.awt.headless=true -jar /usr/home/jduser/JDownloader.jar &
}
#
load_rc_config $name
run_rc_command "$1"

Edit: 2 recommendations i forgot.

Use the archiv extractor, otherwise you open your share on your windows/linux pc, extract it by your own what means that the data you'd like to extract were copied to your workstation, extracted and copied back to your nas.
If JDownloader extract the downloads automatically, you'll find the extracted data on your share without to do anything.
You should also choose the option "delete files after extracting", otherwise you have your data doubled (ziped and extracted).

I've read, the extractor works only after you disable it, reboot your jail, and enable it back again. Yes, it don't extract my files, after downloading. So i've done it this way, but i think you can also ONLY restart JDownloader, without restart your whole machine (jail).

Edit2: Split 4th in 4th a) and 4th b)


Thanks a lot mate!!! very good explained step by step. I use FreeNAS-11.3-U5...
 
Top