How to install qBittorrent with webui on Ubuntu?

qbittorrent_featured
  • Share:
  • share htpcBeginnerShare on FacebookhtpcBeginner on Google+Tweet It
  •   ¦  
    Pages: 1 2 3

It is strongly advised that you change the username / password as soon as possible as it is a security risk to leave the default values. I recommend that this be one of the first things you do after you install qBittorrent. You can choose a new username / password from Options > Preferences window in the Web UI. The new parameters will be taken into account instantly, without restarting qBittorrent.

If you already have a server listening on port 8080, then start qBittorrent webui using the following command:

qbittorrent-nox --webui-port=XXXX

Where, XXXX is your desired unique and available port number. Even if you do not have anything running on port 8080 I still recommend that you run qBittorrent on a different random port for security reasons.

Newshosting Unlimited Usenet

Step 4: Autostart qBittorrent Webui

Starting qBittorrent from commandline is cumbersome. To autostart qBittorrent web interface during boot, create the file /etc/init.d/qbittorrent-nox-daemon and add the following contents (Credit: launchpadlibrarian.net) to it:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          qbittorrent-nox
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts QBittorrent
# Description:       Start qbittorrent-nox on start. Change USER= before running
### END INIT INFO

# Author: Jesper Smith
#

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="QBittorrent"
NAME=qbittorrent-nox
DAEMON=/usr/bin/$NAME
DAEMON_ARGS=""
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/qbittorrent
USER=[USERNAME]

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
	# Return
	#   0 if daemon has been started
	#   1 if daemon was already running
	#   2 if daemon could not be started
	start-stop-daemon -c $USER -b -t --start --quiet  --exec $DAEMON  \
                || return 1

	start-stop-daemon -c $USER -b --start --quiet --exec $DAEMON -- \
		$DAEMON_ARGS \
		|| return 2
	sleep 1
}

#
# Function that stops the daemon/service
#
do_stop()
{
	start-stop-daemon -c $USER --quiet  --stop --exec $DAEMON
	sleep 2
	return "$?"
}


case "$1" in
  start)
	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
	do_start
	case "$?" in
		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
	esac
	;;
  stop)
	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
	do_stop
	case "$?" in
		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
	esac
	;;
  status)
       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
       ;;
  restart|force-reload)
	log_daemon_msg "Restarting $DESC" "$NAME"
	do_stop
	case "$?" in
	  0|1)
		do_start
		case "$?" in
			0) log_end_msg 0 ;;
			1) log_end_msg 1 ;; # Old process is still running
			*) log_end_msg 1 ;; # Failed to start
		esac
		;;
	  *)
	  	# Failed to stop
		log_end_msg 1
		;;
	esac
	;;
  *)
	#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
	exit 3
	;;
esac

If you prefer to download the above code, you may do so you using the download button below:

Change USER=MyUserName to the name of the user whom you want to run qBittorrent daemon as. Also, change DAEMON_ARGS="--webui-port=XXXX" to the port number to which you want qBittorrent to listen. Save and exit. Set correct permissions for the file:

sudo chmod 755 /etc/init.d/qbittorrent-nox-daemon

Then, update the startup scripts using the following command:

sudo update-rc.d qbittorrent-nox-daemon defaults

From your next reboot, qBittorrent webui should start automatically. You can also manually start, stop, and restart qBittorrent-nox using the following commands:

sudo service qbittorrent-nox-daemon start
sudo service qbittorrent-nox-daemon stop
sudo service qbittorrent-nox-daemon restart

For convenience, you could create bash aliases as described in this post. For example, qbitstart could execute sudo service qbittorrent-nox-daemon start. To do so, add the following bash aliases to your /home/user/.bash_aliases:

alias qbitstop='sudo service qbittorrent-nox-daemon stop'
alias qbitstart='sudo service qbittorrent-nox-daemon start'
alias qbitrestart='sudo service qbittorrent-nox-daemon reload'

Like this post? Share it and get Raspberry Pi OpenELEC Media Center 45-page eBook for Free!

Incoming Search Terms:

socks5 прокси 50, crontab qbittorrent-nox, qbittorrent for ubuntu, qbittorrent linux

Comments

  1. AtariBaby says

    I got error messages trying to access the PPA. Wondering if it’s down or defunct. I got the app from application manager instead, and used the preferences in the gui version to activate the web ui version.

    Question: in the init.d script, there is a line that reads “SCRIPTNAME=/etc/init.d/qbittorrent”. You have us naming the file “qbittorrent-nox-daemon”. Is this intentional, or should the filename in “SCRIPTNAME” be the same?

    I would also recommend that in your example for changing share ratio, make the ratio 2.5. Newbies might implement the change without realizing that 0.5 is not good sharing. :p

  2. AtariBaby says

    Follwing the SSL part, on the last command, I got this an error. I paste here but removed the long digits at the beginning just in case it is supposed to be private:
    Error opening Private Key qbittorrent-key
    xxxxxxxxxxxxxxxxx:error:02001002:system library:fopen:No such file or directory:bss_file.c:398:fopen(‘qbittorrent-key’,’r’)
    xxxxxxxxxxxxxxxxx:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:400:
    unable to load Private Key

    • says

      Please make sure you have SSL installed on your system first. Then copy the Private Key (not the public key) in its entirety. The best would be rename the private key instead of copying and pasting contents to another file. Any changes in line breaks or spaces can cause errors. Let me know how it goes.

  3. Stubro says

    Can anyone help me I get the following error when trying to start the service?
    /etc/init.d/qbittorrent-nox-daemon: 50: /etc/init.d/qbittorrent-nox-daemon: Syntax error: “||” unexpected

    • says

      Stubro, there is some syntax error in your /etc/init.d/qbittorrent-nox-daemon file. Are you sure you did not make any mistakes while following Step 4? Make sure the following section of the file is correctly configured without any missing quotes or special characters:

      # PATH should only include /usr/* if it runs after the mountnfs.sh script
      PATH=/sbin:/usr/sbin:/bin:/usr/bin
      DESC=”QBittorrent”
      NAME=qbittorrent-nox
      DAEMON=/usr/bin/$NAME
      DAEMON_ARGS=”–webui-port=XXXX”
      PIDFILE=/var/run/$NAME.pid
      SCRIPTNAME=/etc/init.d/qbittorrent
      USER=MyUserName

  4. says

    Works like a charm!
    The bad thing is that version 2.9.8 doesn’t have working WebUI for Firefox. It was fixed in next update, but I qbittorrent is not in Raspbian repositories, so I will need to install it myself.

  5. Tim says


    Starting qbittorrent-nox-daemon (via systemctl): qbittorrent-nox-daemon.serviceWarning: Unit file of created job changed on disk, 'systemctl --system daemon-reload' recommended.
    Job failed. See system journal and 'systemctl status' for details.
    failed!


    Oct 06 15:15:04 beaglebone sudo[16563]: root : TTY=pts/2 ; PWD=/etc/init.d ; USER=root ; COMMAND=/usr/sbin/service qbittorrent-nox-daemon start
    Oct 06 15:15:04 beaglebone sudo[16563]: pam_unix(sudo:session): session opened for user root by root(uid=0)
    Oct 06 15:15:04 beaglebone systemd[1]: qbittorrent-nox-daemon.service: control process exited, code=exited status=1
    Oct 06 15:15:04 beaglebone systemd[1]: Unit qbittorrent-nox-daemon.service entered failed state.
    Oct 06 15:15:04 beaglebone sudo[16563]: pam_unix(sudo:session): session closed for user root

  6. bu11etpr00f says

    There is an error in your code for generating the SSL Certificate (for 14.04 at least). It should read something as follows:

    mkdir ~/.config/qBittorrent/ssl
    cd ~/.config/qBittorrent/ssl
    sudo openssl genrsa -des3 -out qbittorrent.key 2048
    sudo openssl req -new -key qbittorrent.key -out qbittorrent.cert

    instead of:

    mkdir ~/.config/qBittorrent/ssl
    cd ~/.config/qBittorrent/ssl
    openssl genrsa -des3 -out qbittorrent.cert 1024
    openssl req -new -key qbittorrent-key -out qbittorrent-cert

    With the code you listed, one is going to receive the error:

    “Error opening Private Key qbittorrent-key
    XXXXXXXXXXXXXXX:error:XXXXXXXX:system library:fopen:No such file or directory:bss_file.c:398:fopen(‘qbittorrent-key’,’r’)
    XXXXXXXXXXXXXXX:error:XXXXXXXX:BIO routines:FILE_CTRL:system lib:bss_file.c:400:
    unable to load Private Key”

    Hope this helps someone else. ;)

    • bu11etpr00f says

      It also appears that I forgot to include a few other things which are also missing from the instructions above.

      The actual text needed for the “key” field comes from an “insecure” (txt) key file, created from the secure “key” file (qbitorrent.key), with the following command:

      sudo openssl rsa -in qbittorrent.key -out qbittorrent.txt.key

      And, the text needed for the “Certificate” field comes from a “signed” certificate file, created from both the secure “key” file (qbitorrent.key), and the Certificate Request file (qbittorrent.cert), with the following command:

      sudo openssl x509 -req -days 3650 -in qbittorrent.cert -signkey qbittorrent.key -out qbittorrent.crt

      In all actuality, this whole thing could be made much cleaner if the correct file extensions were used in place of what the example shows, as follows:

      mkdir ~/.config/qBittorrent/ssl
      cd ~/.config/qBittorrent/ssl
      sudo openssl genrsa -des3 -out qbittorrent.key 2048
      sudo openssl req -new -key qbittorrent.key -out qbittorrent.csr
      sudo openssl rsa -in qbittorrent.key -out qbittorrent.key.txt
      sudo openssl x509 -req -days 3650 -in qbittorrent.csr -signkey qbittorrent.key -out qbittorrent.crt

      Definition of files:
      qbittorrent.key (Key – Secure)
      qbittorrent.key.txt (Key – Insecure)
      qbittorrent.csr (Certificate Request)
      qbittorrent.crt (Signed Certificate)

      Reference:
      https://help.ubuntu.com/12.04/serverguide/certificates-and-security.html

  7. lorenzo says

    I have a question wiht ubuntu server 64bit.
    Connect by ssh to the server using the terminal and lauch qbittorrent-nox, but when i close the terminal tthe program stop, it’s possible?
    And how can i start the program in automatic at the boot in ubuntu server?
    Thanks

  8. KC says

    Thanks for creating this guide, its really helpful. I wanted to give a qbittorrent a shot as an alternative to Deluge.

    Everything seems to be functioning properly except enabling https.

    I’ve been able to save all my settings, except for the https setting. It remains enabled after a restart, but the page remains viewable only though http. Https produces a connection error. I’ve created a key and cert, and pasted each into their appropriate boxes in the settings, but it still won’t work. I’ve been pasting all of the text in each file (including the begin and end lines in the file)..

    After saving, the none of the text appears when I reopen the options. Enable Https remains checked however.

    Any help in pointing me to where I should look to debug this issue would be helpful. I’ve spent a few hours searching for a solution, but haven’t had any success.

    I’m running v. 3.1.8 of qBittorrent on Ubuntu 14.04 on a headless server.

    Thanks,
    KC

Leave a Reply

Review our comments policy.

Get your free comments avatar.

.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>