Qbittorrent

From Indie IT Wiki

The qBittorrent project aims to provide a Free Software alternative to µTorrent. Additionally, qBittorrent runs and provides the same features on all major platforms (Linux, Mac OS X, Windows, OS/2, FreeBSD). It is also available for certain NAS appliances.

qBittorrent is based on the Qt toolkit and libtorrent-rasterbar, and can also be run headless on Linux without the need for X as covered in the following tutorial.

HOWTO: HEADLESS SERVER INSTALLATION (No X Server) Ubuntu 15.04 Onwards

Add Repository:

sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable

Install:

sudo apt update && sudo apt install qbittorrent-nox

Add qBittorrent User:

A special user is required for setting up qBittorrent.

sudo adduser qbtuser

Then follow the prompts.

Once qBittorrent is installed and configured it is recommended to disable the ability for the qbtuser to log in to the system for tightened security. See the HOWTO: MODIFY: towards the end of this page.

Create Init Script:

sudo touch /etc/systemd/system/qbittorrent.service
sudo nano /etc/systemd/system/qbittorrent.service # add the following text to the file

[Unit]
Description=qBittorrent Daemon Service
After=network.target

[Service]
Type=forking
User=qbtuser
ExecStart=/usr/bin/qbittorrent-nox -d

[Install]
WantedBy=multi-user.target

CTRL+O then CTRL+X to save and exit file, then reload the daemon:

 sudo systemctl daemon-reload

Initializing Configuration:

sudo su qbtuser
qbittorrent-nox 

The following should be displayed:

*** Legal Notice ***
qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility.

No further notices will be issued. 

Press 'y' key to accept and continue...

If you do press 'y' and you should then see:

******** Information ********
To control qBittorrent, access the Web UI at http://localhost:8080
The Web UI administrator user name is: admin
The Web UI administrator password is still the default one: adminadmin
This is a security risk, please consider changing your password from program preferences.
03/02/2016 15:51:03 - The Web UI is listening on port 8080
03/02/2016 15:51:04 - qBittorrent is successfully listening on ...

At this point switch to your web browser and attempt to access the qBittorrent web interface:

localhost:8080
or
xxx.xxx.xxx.xxx:8080 # where xxx.xxx.xxx.xxx is the IP address of the system running qBittorrent

Default log in details are:

Username: admin
Password: adminadmin

If all is good and you are able to log in go back to the terminal.

Use CTRL+C to terminate the running process which will take you back to the prompt.

Enable Start Up On Boot:

sudo systemctl enable qbittorrent

The above should generate the following:

Created symlink from /etc/systemd/system/multi-user.target.wants/qbittorrent.service to /etc/systemd/system/qbittorrent.service.

HOWTO: START, STOP, STATUS:

sudo systemctl start qbittorrent

sudo systemctl stop qbittorrent

sudo systemctl status qbittorrent

HOWTO: DISABLE:

UPnP # Method 1:

NOTE: The config file will be overwritten with the default port if you fail to stop the service first.

sudo systemctl stop qbittorrent
sudo nano /home/xxxxx/.config/qBittorrent/qBittorrent.conf # where xxxxx is the user running the service

[Preferences]
Connection\UPnP=false
WebUI\UseUPnP=false

CTRL+o then CTRL+x to save and exit.

sudo systemctl start qbittorrent

UPnP # Method 2:

Log in to the web interface, then:

Tools | Options | Web UI (tab) | HTTP Server (section) | Use UPnP / NAT-PMP to forward the port from my router (option - untick) | Save
Tools | Options | Connection (tab) | Listening Port (section) | Use UPnP / NAT-PMP port forwarding from my router (option - untick) | Save

HOWTO: MODIFY:

User Running The Service:

sudo systemctl stop qbittorrent
sudo nano /etc/systemd/system/qbittorrent.service # add the following text to the file

[Service]
User=xxxxx # where xxxxx is the user designated to run the service

CTRL+O then CTRL+X to save and exit file, then reload the daemon and restart the service:

sudo systemctl daemon-reload
sudo systemctl start qbittorrent

New configuration information will created in the users home folder under ./config/qbittorrent.

Port Used By The Web Portal # Method 1:

You may wish to change the default port from 8080 to one of your choosing:

NOTE: The config file will be overwritten with the default port if you fail to stop the service first.

sudo systemctl stop qbittorrent
sudo nano /home/xxxxx/.config/qBittorrent/qBittorrent.conf # where xxxxx is the user running the service

[Preferences]
WebUI\Port=xxxxx # Where xxxxx is your choice of port number

CTRL+o then CTRL+x to save and exit.

sudo systemctl start qbittorrent

Port Used By The Web Portal # Method 2:

Log in to the web interface, then:

Tools | Options | Web UI (tab) | HTTP Server (section) | Port (edit to your liking) | Save

The webpage will automatically refresh and register as a missing page, change to the new port, press enter and log in.

qbtuser Log In:

It is a wise precaution for security disable the ability for the qbtuser to login to the system:

sudo usermod -s /usr/sbin/nologin qbtuser

If necessary this can be reversed with the command:

sudo usermod -s /bin/bash qbtuser

Thanks to github & qBittorrent.

LINKS:

Official qBittorrent Forum

http://www.techsupportalert.com/optimizing-qbittorrent-speed

https://www.linuxbabe.com/bittorrent/qbittorrent-web-ui-ubuntu