Blog/content/posts/2016-03-26-installing-pyload-on-a-raspberry-pi-with-raspbian-jessie.md
2017-10-09 12:03:43 +02:00

4.7 KiB

title author type date url categories tags
Installing pyLoad on a Raspberry Pi with Raspbian Jessie eNBeWe post 2016-03-26T13:25:28+00:00 /2016/03/26/installing-pyload-on-a-raspberry-pi-with-raspbian-jessie/
Allgemein
Bastelkram
Serveradministration
download
java
javascript
pyload
Raspberry Pi
raspbian

If you are anything like me [1], you like to have dedicated Services which do stuff for you. One of the Services I like in particular is pyLoad [2]. This program you be used to automatically load files from OneClick Hosters. This is esspecially useful if you run this on a small computer like the Raspberry Pi [3] and dump the downloaded data to a central Storage like a NAS.

There are lots of blogposts out there which detail how to install pyLoad on a RaspberryPi [4, 5, 6]. For most parts I don't really want to say anything against these, but there was one point in particular that I dislike about all of these. This is the reason why I am now writing my own guide. So let's get started.

In the following I assume that you are running a Raspberry Pi with a recent version of Raspbian. At the point of writing this means you are running some version of Debian Jessie. This is the first reason for this guide, because most guides are written for older Debain versions and they don't care about things like systemd.

First we are going to create a system user for running pyload.

sudo adduser --system pyload

Next we are installing some dependencies for pyLoad. First make sure that you have the following two lines in your /etc/apt/sources.list

deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi

Then we update our package list and install the dependencies.

sudo apt-get update
sudo apt-get -y install git liblept4 python python-crypto python-pycurl python-imaging tesseract-ocr zip unzip python-openssl libmozjs-24-bin
sudo apt-get -y build-dep rar unrar-nonfree
sudo apt-get source -b unrar-nonfree
sudo dpkg -i unrar_*_armhf.deb
sudo rm -rf unrar-*

Please notice the list of packages that are installed here. This is the one point I really dislike about the other guides. Most guides are not installing rhino instead of libmozjs here. Both of these packages are JavaScript environments. The difference between rhino and libmozjs is the language they are implemented in. While rhino is implemented in Java libmozjs is using c++. For this reason you need the whole Java execution environment on your system if you want to use rhino. I don't think it is reasonable to install a complete java runtime on a server that should be running a python program. So I think the C++ implementation is superior in this point.

On older versions of Debian there was the package spidermonkey-bin, which was more or less equivalent to libmozjs,  but newer versions don't ship this anymore.

To get spidermonkey (let's just call it that) running with pyLoad we need to create a symlink.

cd /usr/bin
ln -s js24 js

Now we can download the current version of pyLoad and install that. We are using the current git version which is a bit newer that the latest release.

cd /opt
sudo git clone https://github.com/pyload/pyload.git
cd pyload
sudo -u pyload python pyLoadCore.py

The last line should start the configuration wizard of pyload and create an initial setup. Just follow the on-screen instructions. If everything went well you should have a running pyLoad instance.

If you want to start pyload at every reboot you can create a systemd service file for that. Just create a new file

sudo nano /etc/systemd/system/pyload.service

and dump the following code in there.

[Unit]
Description=Python Downloader
After=network.target

[Service]
User=pyload
ExecStart=/usr/bin/python /opt/pyload/pyLoadCore.py

[Install]
WantedBy=multi-user.target

Now we need to activate this rule with systemd.

sudo systemctl enable pyload.service

After a reboot this should automatically be executed and you can see the status of the service with

sudo systemctl status pyload

I hope this guide is helping you in getting pyload running. Even if you already have a running version, you might want to change  your js interpreter if you are currently using rhino.