Compiling libtorrent-rasterbar and qBittorrent on CentOS 6.5 x64

Compiling libtorrent-rasterbar and qBittorrent on CentOS 6.5 x64

qBittorrent web User InterfaceI finally found the proper uTorrent (wine/Server) replacement for Linux (preferably headless) systems – qBittorrent.

Unfortunately there seems to be no repository out there providing qBittorrent for CentOS 6, so I had to compile it from source – not the easiest task I have to admit.

First off, you’ll need to install some requirements. Since I’m running this on a development box I had most of the compiler tools and libraries already installed, but one thing I did need to install was the boost library (and it’s dev counterpart):
yum install boost boost-devel

If you don’t have the compilers installed, you’ll also need to install them:
yum groupinstall "Development Tools"
or
yum install make gcc gcc-c++ kernel-devel

I used this forum post and initially tried exactly the versions listed there, but that failed (with a very weird compilation error in libtorrent).

So I gave it another try but with the (almost latest) versions available at the time of writing this: libtorrent-rasterbar-0.16.12 and qbittorrent-3.1.3. The absolute latest libtorrent-rasterbar 0.6.13 had an issue not seeing the boost library installed.

 

Compiling libtorrent-rasterbar

Download, configure and compile libtorrent-rasterbar:

cd /usr/src
wget https://web.archive.org/web/20160319192514/http://libtorrent.googlecode.com/files/libtorrent-rasterbar-0.16.12.tar.gz
tar xf libtorrent-rasterbar-0.16.12.tar.gz
cd /usr/src/libtorrent-rasterbar-0.16.12
./configure --disable-debug --prefix=/usr --with-boost-libdir=/usr/lib64
make
make install
ln -s /usr/lib/pkgconfig/libtorrent-rasterbar.pc /usr/lib64/pkgconfig/libtorrent-rasterbar.pc

The last command above is very important for x64 system, as it creates the correct symlink for applications looking at the 32bit version of the libraries; without it compiling qbittorrent will fail on x64 systems.

 

Compiling qBittorrent

Then download, configure, compile and install qbittorrent:

cd /usr/src/
wget http://downloads.sourceforge.net/qbittorrent/qbittorrent-3.1.3.tar.gz?use_mirror=osdn
tar xf qbittorrent-3.1.3.tar.gz
cd qbittorrent-3.1.3
./configure
/usr/bin/gmake
make install

Use ./configure --disable-gui instead to build qbittorrent-nox (CLI only version suitable for headless servers). Then run qbittorrent-nox –webui-port=X to configure the web UI port (defaults to 8080). The rest of the configuration can be done via the web UI (default username is admin and password is adminadmin).

 

Running bittorrent-nox as a service

I found a service script here which works perfectly on CentOS:

#!/bin/sh
#
# chkconfig: - 80 20
# description: qBittorrent headless torrent server
# processname: qbittorrent-nox
#
# Source function library.
. /etc/init.d/functions

QBT_USER="root"
QBT_LOG="/var/log/qbittorrent.log"

prog=qbittorrent-nox
RETVAL=0

start() {
        if [ -x /etc/rc.d/init.d/functions ]; then
                daemon --user $QBT_USER $prog
        else
                su - $QBT_USER -c "$prog" > /var/log/qbittorrent.log &
        fi
	echo -n $"Starting $prog: "
        RETVAL=$?
        [ $RETVAL = 0 ] && success || failure
	echo
        return $RETVAL
}

stop() {
	echo -n $"Stopping $prog: "
	killall qbittorrent-nox
	success
    	echo
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload)
        stop
        sleep 2
        start
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|reload}"
        exit 1
esac

exit $RETVAL
#
# end

Simply save it as /etc/init.d/qbittorrentd, then chmod +x it and you’re good to go
service qbittorrentd start

 

Remember to use (and periodically update) a P2P IP blocklist.

This forum post helped me figure out that libtorrent-rasterbar wouldn’t compile on my 64bit system without adding –with-boost-libdir=/usr/lib64.

17 Comments

  1. Thanks for the tut! However I took a different route and installed qt5 from epel, qbittorrent 3.3.0alpha, libtorrent-rasterbar-1.0.5 (updated the latest patch with arvid’s main libttorrent site cause 1.0.6 isn’t out yet on rasterbar). I also installed a different boostlib version I got from here: http://repo.enetres.net/repoview/boost-devel.html

    I also commented out in the configure of libttorrent:
    #CXXFLAGS=”$CXXFLAGS -ftemplate-depth=120″

    So if anyone is in the same boat, I hope those clues help!

    Me
  2. Hi Zed
    I did everything that you said but in the last part I got these errors:
    # /usr/bin/gmake
    gmake: *** No targets specified and no makefile found. Stop.
    # make install
    make: *** No rule to make target `install’. Stop

      1. Yes I exactly used the same version…
        the configure steps wasn’t successfully either :
        Verifying Qt 4 build environment … fail

        Reason: Unable to find the ‘qmake’ tool for Qt 4.

        Be sure you have a proper Qt 4.0 build environment set up. This means not
        just Qt, but also a C++ compiler, a make tool, and any other packages
        necessary for compiling C++ programs.

        If you are certain everything is installed, then it could be that Qt 4 is not
        being recognized or that a different version of Qt is being detected by
        mistake (for example, this could happen if $QTDIR is pointing to a Qt 3
        installation). At least one of the following conditions must be satisfied:

        1) –qtdir is set to the location of Qt
        2) $QTDIR is set to the location of Qt
        3) QtCore is in the pkg-config database
        4) qmake is in the $PATH

        This script will use the first one it finds to be true, checked in the above
        order. #3 and #4 are the recommended options. #1 and #2 are mainly for
        overriding the system configuration.

          1. Taking a second read at the error… Be sure you have a proper Qt 4.0 build environment set up. This means not just Qt, but also a C++ compiler, a make tool, and any other packages necessary for compiling C++ programs.
            You’re probably missing the compilers (which I have installed from previous work and didn’t list in the post). Try either
            yum groupinstall "Development Tools" or
            yum install make gcc gcc-c++ kernel-devel to install the compilers.

            Zed
          2. I cannot test which compilers are required as I already have them installed. And removing them would break their dependencies.

            Try installing make gcc gcc-c++ kernel-devel and then attempt the ./configure once more.

            Zed
        1. i had the same problem .. however, the message is misleading: there is nothing wrong with your qt

          the issue is that you have not finished installing libtorrent. The above instructions have left out the following commands after the ./configure –disable-debug –blahblah :

          make
          make install

          then do that ln -s command at the end

Leave a Reply