Hi guys, today I am going to show you how to install and configure uTorrent server on some of the Linux distros like Ubuntu, Debian, Fedora, CentOS, Slackware, openSUSE and Arch Linux. We are going to learn the basic settings of this BitTorrent client, how set the password,bandwidth,directories and how to get notified when your download finishes or change state.
What you will need
In most setups the whole process is as simple as download and extract the contents of uTorrent tarball, however, in some systems the installation of some missing shared libraries will be needed and here is what you will need.
- OpenSSL 1.0.0 shared libraries - This is the real requirement that may be in different version or missing in some distributions
- Wget - This tool will be used to download everything and also is needed if you want voice notifications
- tar, gzip and unzip - uTorrent for Linux comes tarred and gzipped and the web interface is zipped inside the main tarball
- GCC, Binutils, make - This will be used if you need to build OpenSSL from source
- ar - This will be used if you don't have OpenSSL on your system and you decide to lend it from Debian instead of compile from sources
- ldd - This utility will used to list dynamic dependencies of the uTorrent binary
- mpg123 - This is what will play our voice notifications
- bzip2 - If you need to compile mpg123 from sources, you will need it to extract the sources from the tarball
In fact, if you meet all requirements, you will be able to run uTorrent on virtually any Linux flavor, the distros a mention on the article are the ones that i tried myself.
In this step we have two main options, for ubuntu and debian systems, there are packages and for all other distributions we are going to use the Debian package
On Debian and other Linux distributions do this:
You can also download other versions of uTorrent for Linux and choose the package for your system
Extracting and installing the files
Let's extract the tarball file in /opt:
tar zxf utserver.tar.gz -C /opt/
Enter the uTorrent directory :
The web interface files comes zipped, so unzip it:
Now check if you are ready to run the utserver binary with the ldd script:
ldd utserver | egrep 'not found'
If the above command gives you any output, some runtime dependencies are missing, otherwise you are done installing, jump to Running uTorrent section
The following image with the complete output of ldd shows that the shared libraries libssl.so.1.0.0 and libcrypto.so.1.0.0 are not installed:
Installing libssl.so.1.0.0 and libcrypto.so.1.0.0
The shared libs libssl.so.1.0.0 and libcrypto.so.1.0.0 are part of OpenSSL version 1.0.0, in some systems, the OpenSSL is provided in different versions, some of which doesn't comes with these shared libraries.
Here is how to install them
On Ubuntu and Debian try to install the package libssl1.0
apt-get install libssl1.0
On OpenSUSE try libopenssl1_0_0
zypper install libopenssl1_0_0
Depending on your system the there may be a package or not. The following should not fail on Fedora, CentOS, Slackware, Gentoo, Arch Linux and other distributions:
1) Find other versions of libssl.so and libcrypto.so on your system and create a symbolic link, despite that i made before for other reasons, it may not work depending on the version of libssl of your system.
You may find the library in /lib, /usr/lib and /usr/local/lib for 32-bits and /lib64,/usr/lib64 and /usr/local/lib64 for 64-bits
find /lib64 -iname libssl.so* find /lib64 -iname libcrypto.so*
And link the library with version x.y.z to libssl.so.1.0.0 and libcrypto.so.1.0.0
ln -s /lib64/libssl.so.x.y.z /lib64/libssl.so.1.0.0 ln -s /lib64/libcrypto.so.x.y.z /lib64/libcrypto.so.1.0.0
2) The safest choice if you don't have a compatible library, is to download and compile OpenSSL from sources
wget https://www.openssl.org/source/openssl-1.0.0r.tar.gz cd openssl-1.0.0r ./config shared && make
Note that we are configuring it to build shared libraries, that wil create libssl.so.1.0.0 and libcryto.so.1.0.0.
To avoid conflicts with the current OpenSSL shipped with your system, copy only the files you need
cp libssl.so.1.0.0 libcrypto.so.1.0.0 /lib64
3) Install the library from a package of other Linux distribution
Here are Debian packages that you can try
mkdir debianlibssl && cd debianlibssl wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1e-2+deb7u16_amd64.deb ar xv libssl1.0.0_1.0.1e-2+deb7u16_amd64.deb && tar zxvf data.tar.gz cp usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /lib64
mkdir debianlibssl && cd debianlibssl wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1e-2+deb7u16_i386.deb ar xv libssl1.0.0_1.0.1e-2+deb7u16_i386.deb && tar zxfv data.tar.gz cp usr/lib/i386-linux-gnu/libssl.so.1.0.0 usr/lib/i386-linux-gnu/libcrypto.so.1.0.0 /lib
Other missing requirements
If there are still missing libraries or program, you may use some tools of your distribution to find out what package you need for a given file, let's suppose libgcc_s.so.1, the command for each distro would be something like this:
ubuntu#apt-get install apt-file && apt-file update && apt-file search libgcc_s.so.1 opensuse#zypper wp libgcc_s.so.1 slackware#slackpkg file-searh libgcc_s.so.1 fedora22#dnf provides libgcc_s.so.1preprocessing centos#yum provides libgcc_s.so.1 fedora_old#yum provides libgcc_s.so.1 arch#pacman -S pkgfile && pkgfile --update && pkgfile -r libgcc_s.so.1
Gentoo users should try this site: http://www.portagefilelist.de/site/query to search for package
Install some package, let's suppose wget here:
centos#yum install wget gentoo#emerge -s wget arch#pacman -S wget slackware#slackpkg install wget fedora_current#dnf install wget fedora20#yum install wget debianlike#apt get install
Once you solved the problem of missing dependencies, enter the uTorrent directory and take a look on the output of the following command:
This will show you the parameters of the command line interface
Running in standalone mode
Inside uTorrent directory, run the utserver binary with the settings path pointing to it:
./utserver -settingspath $(pwd)
Running as daemon on startup
If you want that utserver run when you system starts, open the rc.local file and paste the following code snippet:
OLDPWD=$(pwd) cd /opt/utorrent-server* ./utserver -settingspath $(pwd) -daemon -logfile /var/log/utorrent.log cd $OLDPWD
This file is under /etc, /etc/rc.d or /etc/init.d/ depending on your distribution and in some versions of this files ends with an exit 0 sentence, you must paste the code before this sentence.
With utserver running, enter http://localhost:8080/gui, the default username is admin and no password is required by default:
OK, you are running the service and already logged in, you can start download now, however there is some things you would like to set, so click on the gear icon on the toolbar to open the configuration panel:
On the setting panel, click on Web UI at the sidebar and set the password:
Other thing that may be useful is to set the download directories, on the sidebar, click in Directories:
On the image above I have set uTorrent to move the complete downloads to my downloads directories, also set it to automatically load torrent files from this directories and delete them when it is loaded.
If your bandwidth is limited for any reason, like a shared connection or you are running a mission critic service, you may like the following.
Global bandwidth settings
To limit your bandwidth globally, click on Bandwidth at sidebar and set the limit number of connections and speed values. The values are in kiloBytes, 0 means unlimited:
If you want something more flexible, scheduler feature is for you, check the option 'Enable Scheduler', set the speed limits and click on the squares of the matrix:
In the example above, we set uTorrent that from monday to friday stop its activities from 12:00 to 12:59 and that it should limit the speed from 18:00 to 19:59 all days from tuesday to friday.
In uTorrent you can run arbitrary programs when the state of a torrent changes, in fact there is a small API that can send parameters about the event to the called program.
Here is a small Bash script that will speak the state of a file when it's state change. This is just a example of what you can do with the torrent state API of uTorrent.
Create the file /usr/local/bin/speech.sh and paste the following code on it:
#!/bin/bash #dirty preprocessing file="$(echo -n \"$1\" | sed s'/ \|_\|-/%20/'g)" state="$2" # Google translate's Text To Speech API url="http://translate.google.com/translate_tts?tl=en&q=$file%20$state" # pipe the mp3 stream from Google to the player wget --user-agent='Mozilla/5.0' "$url" -O - | mpg123 --timeout 20 -
As you can see, here is where mpg123 is called on our script, if your distribution does not provide a packge for it you can download it on the official website http://www.mpg123.de/download.shtml
The following command will download the latest version, compile and install it under /usr/local:
wget http://www.mpg123.de/snapshot && tar jxvf snapshot && cd mpg123-* && ./configure --prefix=/usr/local && make && make install
Give execution rights to the speech.sh script:
chmod +x /usr/local/bin/speech.sh
Now, in the uTorrent settings, click on Run program and fill the two input fields as follows:
/usr/local/bin/speech.sh '%N' complete
/usr/local/bin/speech.sh '%N' '%M'
Once you have a password, pointed directories, granted that uTorernt will not use all your internet and possibly set other things, it is time to download, here are two ways, click on file icon highlighted in red to upload a torrent file to the server or paste a magnet link on the input field highlighted in blue:
Get the files
If you are running the server in your localhost and have set the directories, your files will be moved automatically to the place you configured earlier, otherwise, your files will be on the uTorrent directory. If your service is running elsewhere in your network you can download the file to the local computer by clicking on the torrent name and then on the icon highlighted on the following image:
That's all folks, you can now download and share your files from your favorite Linux distribution. If you have any question or want to share your own experience with uTorrent and the BitTorrent protocol leave us a comment. Thanks for reading!