From 9064b66242f4de0e00fd549707f3ef54f3536ccf Mon Sep 17 00:00:00 2001
From: Aeriem <45237401+Aeriem@users.noreply.github.com>
Date: Thu, 16 Jan 2020 16:31:22 +0100
Subject: [PATCH] Major update of the guide, feel free to mention me or correct
any mistakes that might have slipped
---
...r-Raspbian-(Debian-9.0)-for-ARM-devices.md | 199 +++++++++---------
1 file changed, 97 insertions(+), 102 deletions(-)
diff --git a/Compiling-qBittorrent-nox-4.x-on-DietPi-or-Raspbian-(Debian-9.0)-for-ARM-devices.md b/Compiling-qBittorrent-nox-4.x-on-DietPi-or-Raspbian-(Debian-9.0)-for-ARM-devices.md
index c2ab12c..6a77834 100644
--- a/Compiling-qBittorrent-nox-4.x-on-DietPi-or-Raspbian-(Debian-9.0)-for-ARM-devices.md
+++ b/Compiling-qBittorrent-nox-4.x-on-DietPi-or-Raspbian-(Debian-9.0)-for-ARM-devices.md
@@ -2,61 +2,59 @@
[DietPi](https://dietpi.com/ "DietPi Homepage") is a refined Linux distribution for ARM SoCs such as Raspberry Pi 3 B+ and ASUS Tinker Board.
-Both are based on Debian. Debian 9.0 ships with a patched version of an older qBittorrent-nox release (3.3.7). qBittorrent 4.x has many improvements to the webUI component which are of particular use for headless operation.
+Both are based on Debian. Debian 9.0 ships with a patched version of an older qBittorrent-nox release (3.3.7). qBittorrent 4.x has many improvements to the webUI component which are of particular use for headless operation.
-This guide outlines the steps needed to compile qBittorrent-nox 4.1.x and run it as a service. Both DietPi and Raspbian provide pre-compiled qBittorrent using either `dietpi-software` or `apt`. Use this guide if you want to run the most recent qBittorrent (and libtorrent-rasterbar).
+This guide outlines the steps needed to compile qBittorrent-nox 4.2.x and run it as a service. Both DietPi and Raspbian provide pre-compiled qBittorrent using either `dietpi-software` or `apt`. Use this guide if you want to run the most recent qBittorrent (and libtorrent-rasterbar).
-This guide was made possible by the authors of the [Debian/Ubuntu compilation guide](https://github.com/qbittorrent/qBittorrent/wiki/Compiling-qBittorrent-on-Debian-and-Ubuntu "Debian/Ubuntu compilation guide") and [Guide on running qBittorrent as a service](https://github.com/qbittorrent/qBittorrent/wiki/Setting-up-qBittorrent-on-Ubuntu-server-as-daemon-with-Web-interface-(15.04-and-newer) "Guide on running qBittorrent as a service"). A few DietPi-specific amendments are included.
+This guide was made possible by the authors of the [Debian/Ubuntu compilation guide](https://github.com/qbittorrent/qBittorrent/wiki/Compiling-qBittorrent-on-Debian-and-Ubuntu "Debian/Ubuntu compilation guide") and [Guide on running qBittorrent as a service](https://github.com/qbittorrent/qBittorrent/wiki/Setting-up-qBittorrent-on-Ubuntu-server-as-daemon-with-Web-interface-(15.04-and-newer) "Guide on running qBittorrent as a service"). A few DietPi-specific amendments are included.
+
+**Major update:**
+
+**In order to bring this guide up-to-date with the latest changes, I will do a pretty major update of it. I tested the changes, but some things might have slipped. Please feel free to mention me ([Aeriem](https://github.com/Aeriem)) should any issues arise. A big thanks to the original author of this guide ([jtmoon79](https://github.com/jtmoon79)).**
# Table of Contents
-* [Dependencies ](#dependencies-)
-* [Compiling Libtorrent ](#compiling-libtorrent-)
- * Either
+* [Dependencies](#dependencies)
+* [Compiling Libtorrent](#compiling-libtorrent)
+ * [Get the source code](#get-the-source-code)
* [A. `git clone` from repository](#a-git-clone-from-repository)
- * [B. download the latest release](https://github.com/arvidn/libtorrent/releases)
- * [Compile Libtorrent 1.1.x](#compile-libtorrent-11x)
- * [Add Libtorrent as system library ](#add-libtorrent-as-system-library-)
-* [Compiling qBittorrent-nox ](#compiling-qbittorrent-nox-)
- * [Compile 4.1.x version](#compile-41x-version)
+ * [B. Download the latest release](#b-download-the-latest-release)
+ * [Compile Libtorrent](#compile-libtorrent)
+ * [Add Libtorrent as a system library](#add-libtorrent-as-a-system-library)
+* [Compiling qBittorrent-nox](#compiling-qbittorrent-nox)
+ * [Get the source code](#get-the-source-code-1)
* [A. `git clone` from repository](#a-git-clone-from-repository-1)
- * [B. Download the release source code](https://github.com/qbittorrent/qBittorrent/releases)
+ * [B. Download the latest release](#b-download-the-latest-release-1)
* [Compile qBittorrent-nox](#compile-qbittorrent-nox)
-* [Running qBittorrent-nox on boot ](#running-qbittorrent-nox-on-boot-)
+* [Running qBittorrent-nox on boot](#running-qbittorrent-nox-on-boot)
* [Add user for qBittorrent-nox service](#add-user-for-qbittorrent-nox-service)
* [Create systemd service file](#create-systemd-service-file)
* [Run and check systemd service status](#run-and-check-systemd-service-status)
-* [Updating qBittorrent-nox ](#updating-qbittorrent-nox-)
- * [Get a copy of the latest qBittorrent release version](#get-a-copy-of-the-latest-qbittorrent-release-version)
- * [check version, install, check version](#check-version-install-check-version)
+* [Updating qBittorrent-nox](#updating-qbittorrent-nox)
+ * [Updating an already compiled version of qBittorrent-nox](#updating-an-already-compiled-version-of-qBittorrent-nox)
+ * [Checking the version to verify that the binary got updated](#checking-the-version-to-verify-that-the-binary-got-updated)
-# Dependencies
-You will first need to install various tools and libraries needed for compilation.
+# Dependencies
+
+You will first need to install various tools and libraries needed for compilation.
~~~~
-sudo apt-get install \
- build-essential \
- pkg-config \
- automake \
- libtool \
- libc6-dev \
- libboost-dev \
- libboost-system-dev \
- libboost-chrono-dev \
- libboost-random-dev \
- libssl-dev \
- qtbase5-dev \
- qttools5-dev-tools \
- libqt5svg5-dev \
- zlib1g-dev
+sudo apt install build-essential pkg-config automake libtool libc6-dev libboost-dev libboost-system-dev libboost-chrono-dev libboost-random-dev libssl-dev qtbase5-dev qttools5-dev-tools libqt5svg5-dev zlib1g-dev
~~~~
-If you choose to retrieve source code using `git clone` then also `sudo apt-get install git`.
+If you choose to retrieve source code using `git clone`, then also `sudo apt install git`.
-# Compiling Libtorrent
-DietPi's repositories include an older version of [Libtorrent](https://libtorrent.org/ "Libtorrent"). You will need to compile Libtorrent 1.1.x to get qBittorrent-nox 4.x running.
+# Compiling Libtorrent
-To get the Libtorrent 1.1.x source code, either
+DietPi's and Raspbian's repositories include older versions of [Libtorrent](https://libtorrent.org/). You will need to compile Libtorrent 1.2.x to get qBittorrent-nox 4.2.x running.
+
+## Get the source code
+
+Two versions of Libtorrent are currently maintained: 1.1.x and 1.2.x.
+
+Since release 4.2.0, qBittorrent makes use of the newer 1.2.x version, so get the latest release of this one.
+
+To get the Libtorrent source code, either:
A. `git clone ...`
@@ -68,37 +66,29 @@ B. `wget ...`
git clone https://github.com/arvidn/libtorrent.git
cd libtorrent
# select the latest release tag
-git checkout $(git tag | grep libtorrent-1_1_ | sort -t _ -n -k 3 | tail -n 1)
+git checkout $(git tag | grep libtorrent-1_2_ | sort -t _ -n -k 3 | tail -n 1)
~~~~~
-### B. download [the latest release](https://github.com/arvidn/libtorrent/releases)
+### B. Download the [latest release](https://github.com/arvidn/libtorrent/releases)
-using release *libtorrent_1_2_0* in this example
~~~~~
-wget https://github.com/arvidn/libtorrent/archive/libtorrent_1_2_0.zip
-unzip libtorrent_1_2_0.zip
-cd libtorrent-libtorrent_1_2_0
+wget https://github.com/arvidn/libtorrent/archive/libtorrent-1_2_3.zip
+unzip libtorrent-1_2_3.zip
+cd libtorrent-libtorrent-1_2_3
~~~~~
-NOTE: libtorrent 1.2 is reported to not work with the current release version of qBittorrent (4.1.6). You need to use libtorrent 1.1.x.
-
-## Compile Libtorrent 1.1.x
+## Compile Libtorrent
~~~~
./autotool.sh
-export CXXFLAGS=-std=c++11
-./configure \
- --disable-debug \
- --enable-encryption \
- --with-boost-libdir=/usr/lib/arm-linux-gnueabihf \
- --with-libiconv
+./configure --disable-debug --enable-encryption --with-boost-libdir=/usr/lib/arm-linux-gnueabihf --with-libiconv CXXFLAGS="-std=c++14"
make -j$(nproc)
sudo make install
~~~~~
#### out of memory (OOM)
-If OOM errors occur then add a swap file.
+If OOM errors occur, add a swap file.
~~~~~
sudo dd if=/dev/zero of=/.swapfile bs=1M count=1024
@@ -111,9 +101,9 @@ sudo swapoff /.swapfile
sudo rm /.swapfile
~~~~~
-(Those commands were copied from [here](https://dev.deluge-torrent.org/wiki/Building/libtorrent#TemporarySwapFileforRasperryPiorlowmemorysystems)).
+(Those commands were copied from [here](https://dev.deluge-torrent.org/wiki/Building/libtorrent#TemporarySwapFileforRasperryPiorlowmemorysystems).)
-One example manifestation of an OOM error on Raspbian OS looks like
+One example manifestation of an OOM error on Raspbian OS looks like:
~~~~~
$ make
@@ -123,86 +113,100 @@ make[1]: Entering directory '/tmp/libtorrent-libtorrent_1_2_0/src'
g++: internal compiler error: Killed (program cc1plus)
~~~~~
-## Add Libtorrent as system library
+## Add Libtorrent as a system library
You will need to add Libtorrent as a system library or qBittorrent-nox won't run after you compile it.
-Create file `/etc/ld.so.conf.d/libtorrent.conf` with contents
-
-~~~~~
-/usr/local/lib
-~~~~~
+Create a file `sudo nano /etc/ld.so.conf.d/libtorrent.conf` with contents `/usr/local/lib`.
Run `sudo ldconfig` afterward.
-Check if your LD_LIBRARY_PATH
environment variable is set and the path /usr/local/lib
is included.
+Check if your `LD_LIBRARY_PATH` environment variable is set and the path `/usr/local/lib` is included: run `env` in your terminal and look for `LD_LIBRARY_PATH`.
-Simply run env
in your terminal and look for LD_LIBRARY_PATH
.
-If so, you are good to go. If not, add the path to the variable:
- export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}
+If so, you are good to go. If not, add the path to the variable: `export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}`
-# Compiling qBittorrent-nox
+# Compiling qBittorrent-nox
-## Compile 4.1.x version
+## Get the source code
-To get the qBittorrent-nox source code, either
+To get the qBittorrent-nox source code, either:
-A. compile a cloned git repository _or_
+A. `git clone ...`
-B. download a release source code.
+B. `wget ...`
### A. `git clone` from repository
~~~~
-git clone -b v4_1_x https://github.com/qbittorrent/qBittorrent
+git clone -b v4_2_x https://github.com/qbittorrent/qBittorrent
cd qBittorrent
~~~~~
-You may select the branch version on the [branches page](https://github.com/qbittorrent/qBittorrent/branches).
+You may select the branch version on the [branches page](https://github.com/qbittorrent/qBittorrent/branches).
-### B. Download the [release source code](https://github.com/qbittorrent/qBittorrent/releases)
-
-Using release *release-4.1.5* in this example,
+### B. Download the [latest release](https://github.com/qbittorrent/qBittorrent/releases)
~~~~
-wget https://github.com/qbittorrent/qBittorrent/archive/release-4.1.5.zip
-unzip release-4.1.5.zip
-cd qBittorrent-release-4.1.5
+wget https://github.com/qbittorrent/qBittorrent/archive/release-4.2.1.zip
+unzip release-4.2.1.zip
+cd qBittorrent-release-4.2.1
~~~~~
## Compile qBittorrent-nox
~~~~
-./configure --disable-gui --enable-systemd --with-boost-libdir=/usr/lib/arm-linux-gnueabihf
+./configure --disable-gui --enable-systemd --with-boost-libdir=/usr/lib/arm-linux-gnueabihf CXXFLAGS="-std=c++14"
make -j$(nproc)
sudo make install
~~~~~
NOTE: Review [Ubuntu/Debian compilation guide](https://github.com/qbittorrent/qBittorrent/wiki/Compiling-qBittorrent-on-Debian-and-Ubuntu#Compiling_qBittorrent_with_the_GUI) if you want to run qBittorrent with a GUI.
-The binary should be located at `/usr/local/bin/qbittorrent-nox`. If `qbittorrent-nox` was installed using `apt` then that binary will be at `/usr/bin/qbittorrent-nox`. _Do not confuse them!_
+The binary should be located at `/usr/local/bin/qbittorrent-nox`. If `qbittorrent-nox` was installed using `apt` then that binary will be at `/usr/bin/qbittorrent-nox`. _Do not confuse them!_
-**WebUI access information**
+**Web UI access informations**
* _http://localhost:8080_
* Username: _admin_
* Password: _adminadmin_
qBittorrent-nox is currently installed as a terminal application, which is not optimal for headless use. We now will add qBittorrent-nox as a service.
-# Running qBittorrent-nox on boot
+# Running qBittorrent-nox on boot
## Add user for qBittorrent-nox service
+For Raspbian:
+~~~~
+sudo useradd -rm qbittorrent -G pi -s /usr/sbin/nologin
+~~~~
+
+For DietPi:
~~~~
sudo useradd -rm qbittorrent -G dietpi -s /usr/sbin/nologin
~~~~
## Create systemd service file
-_UPDATE:_ this may not be necessary if qBittorrent compilation was configured with flag `--enable-systemd`.
+_UPDATE:_ this **may** not be necessary if qBittorrent compilation was configured with flag `--enable-systemd`.
-Create a systemd service file at `/etc/systemd/system/qbittorrent.service`. Contents are:
+Create a systemd service file `sudo nano /etc/systemd/system/qbittorrent.service`.
+Contents for Raspbian:
+~~~~
+Description=qBittorrent Daemon Service
+After=network.target
+
+[Service]
+User=qbittorrent
+Group=pi
+ExecStart=/usr/local/bin/qbittorrent-nox
+ExecStop=/usr/bin/killall -w qbittorrent-nox
+
+[Install]
+WantedBy=multi-user.target
+~~~~~
+
+Contents for DietPi:
~~~~
Description=qBittorrent Daemon Service
After=network.target
@@ -215,47 +219,38 @@ ExecStop=/usr/bin/killall -w qbittorrent-nox
[Install]
WantedBy=multi-user.target
-~~~~~
+~~~~~
## Run and check systemd service status
+
~~~~
sudo systemctl daemon-reload
sudo systemctl start qbittorrent
sudo systemctl status qbittorrent
~~~~~
-The `systemctl status` command should show qBittorrent-nox is active and running.
+The `systemctl status` command should show qBittorrent-nox is `active (running)`.
-Enable `qbittorrent` service during boot.
+Enable `qbittorrent` service during boot: `sudo systemctl enable qbittorrent`.
-~~~~
-sudo systemctl enable qbittorrent
-~~~~~
+# Updating qBittorrent-nox
-# Updating qBittorrent-nox
+## Updating an already compiled version of qBittorrent-nox
-## Get a copy of the latest qBittorrent release version
-
-On DietPi, you will need to run the following commands to update an already compiled version of qBittorrent-nox:
~~~~
systemctl stop qbittorrent
-./configure --disable-gui --with-boost-libdir=/usr/lib/arm-linux-gnueabihf
+./configure --disable-gui --with-boost-libdir=/usr/lib/arm-linux-gnueabihf CXXFLAGS="-std=c++14"
sudo make -j$(nproc)
make install
~~~~
-## check version to verify that the binary got updated.
+## Checking the version to verify that the binary got updated
~~~~
sudo systemctl stop qbittorrent
-
/usr/local/bin/qbittorrent-nox --version
~~~~
If the version has changed then the new version was successfully compiled and installed!
-Restart the `qbittorrent` service.
-
-~~~~
-sudo systemctl start qbittorrent
-~~~~
\ No newline at end of file
+Restart the `qbittorrent` service: `sudo systemctl start qbittorrent`.
\ No newline at end of file