Categories: Ciencia, Internet, main, Tech

How to install jdownloader: headless

Here the instructions on how to install jdownloader in a headless server, in my case my raspberry pi. So instructions are ubuntu based but you can substitute the commands with the ones from your distribution.

First, let’s Install Java
sudo apt install openjdk-11-jre-headless

Then create a folder for jdownloader [we will download the installer and install it in this folder]
sudo mkdir ~/jdownloader

Move to that directory
sudo cd ~/jdownloader

Download jdownloader latest version
sudo wget http://installer.jdownloader.org/JDownloader.jar

Change the owner of the downloaded file.

Note: The owner should be a valid group or user that will run the program
example: wheel/raspi
sudo chown wheel:raspi JDownloader.jar

Now install/execute jdowloader
sudo java -jar /opt/jdownloader/JDownloader.jar -norestart

Note: You will get a lot of information in the screen.
Jdownloader will begin to download and update the necessary files

If an update it’s need it, jdownloader will ask you, something like this:

|—————————Headless Information——————————-
| New update available
| A new update is available. Do you want to download it now?
| Enter y -> Download now
| Enter n -> Later

Choose y and wait

After a while you won’t see any new information being displayed, exit the program/screen using CTRL + C

Now search and confirm jdownloader isn’t running
sudo ps -aux | grep jdownloader

Note: the result should be only one line, which it’s the grep command that you just ran

username 162668 0.0 0.0 6044 660 pts/0 S+ 11:05 0:00 grep –color=auto jdownloader

if you get an extra line like
username 160587 2.0 21.9 3878712 204656 ? Ssl 09:28 2:01 /usr/bin/java -Djava.awt.headless=true -jar /home/nehemoth/jdownloader2/JDownloader.jar

just kill the program with
sudo kill -9 160587
160587: being YOUR running program ID

run the command again
sudo java -jar ~/jdownloader2/JDownloader.jar -norestart

Wait untill jdownload will ask you for your https://my.jdownloader.org/ username & password
Note: if you don’t have one this is the moment to create one

Wait till’ Update Progress: 100%

You can confirm the connection now
Go to https://my.jdownloader.org/ with your credentials

Select Connect JDownloader in the link near the “Your JDOWNLOADERS” message.

Now, exit the program one last time with CTRL + C

Create the service
Note: use your favorite editor, like nano or vim. I like vi

sudo vi /etc/systemd/system/jdownloader.service

[Unit]
Description=JDownloader Service
After=network.target

[Service]
Environment=JD_HOME=~/jdownloader2
Type=oneshot
ExecStart=/usr/bin/java -Djava.awt.headless=true -jar ~/jdownloader2/JDownloader.jar
RemainAfterExit=yes

#Should be owner of ~/jdownloader2

User=raspi
Group=wheel

[Install]
WantedBy=multi-user.target

Enable the service so it runs with the system
sudo systemctl enable jdownloader.service

Then run your newly created service
sudo systemctl start jdownloader.service

Check that everything ran just fine
sudo systemctl status jdownloader.service

if you see any errors, you should check your service file.
If you do any modification, remember to reload before running it again
sudo systemctl daemon-reload

If everything OK, you should be able to connect to your downloads using https://my.jdownloader.org/

Please, let me know if you find any error. Leave a message.

Article info