← cd ~/blog

less utorrent-howto-install-and-setup-utserver-in-debian-wheezy.md

uTorrent®: howto install and setup utserver in Debian Wheezy

#Bash#Debian & Sysadmin archive

# historical archive — written years ago, kept as it was. Some info is dated.

As the title says, we’ll be installing and configuring utserver on a machine running Debian Wheezy. µTorrent®, as you all know, is the world’s No. 1 torrent download client on the desktop; utserver does the same but on the server side.

First things first: this howto is provided as is.
Make a backup of everything before every change, because I’m not responsible for any mistakes you make! With a backup you can roll back; without a backup, don’t even start following the next steps!

INSTALLATION

Let’s move into the /opt directory, download and extract the package

cd /opt
wget -c "http://www.utorrent.com/intl/it/downloads/complete/os/linux-i386-debian-7-0/track/beta" -O utserver.tar.gz
tar xfzv utserver.tar.gz
ln -sv /opt/utorrent-server-alpha-v3_3 /opt/utorrent
ln -sv /opt/utorrent/utserver /usr/bin/utserver

For our convenience we created a symbolic link to the folder containing our daemon.

For greater security we’ll run the server not as root but as a normal user; so let’s go ahead and create a new user and change the permissions of the folder containing the files needed for it to work:

useradd -c "uTorrent Server User" -d /opt/utorrent/server -s /bin/false utorrent
chown -R utorrent:users /opt/utorrent/

To find out whether the server binary will start, do a quick check with the following command:

ldd -r /opt/utorrent/utserver

if you get errors, go ahead and install the missing dependencies. Generally the most common error is caused by the missing libssl package. On Debian Wheezy we’ll install the “libssl1.0.0” package

apt-get install libssl1.0.0

Installation complete!

CONFIGURATION

Let’s create a basic configuration file. By default the server will open port 8080 so it can be reached through an ordinary browser. We’ll change it because that port is already listening for other services running on the server.

Let’s create the file utserver.conf in the directory /opt/utorrent/server/

cd /opt/utorrent/server/
vi utserver.conf

What follows is my file; you can use it as an example:

################################################################################
# uTorrent Linux Server Configuration File
################################################################################
#
# All commented (ie: line starts with "#") lines are the default settings.
# Remove the comment mark and modify to override those settings.
# See documentation for explanation.
#
################################################################################
#
# bind_ip: ""
ut_webui_port: 19080
#ut_webui_dir:/opt/utorrent/server/settings/
bind_port: 6881
max_ul_rate: -1
max_ul_rate_seed: -1
conns_per_torrent: 50
max_total_connections: 200
auto_bandwidth_management: true
max_dl_rate: -1
seed_ratio: 0
seed_time: 0
token_auth_enable: true
dir_root:/opt/utorrent/data
dir_completed:
dir_download:
dir_torrent_files:/opt/utorrent/server/torrents
dir_temp_files:/opt/utorrent/server/tmp
dir_autoload:
dir_autoload_delete: false
upnp: true
natpmp: true
lsd: true
dht: true
pex: true
rate_limit_local_peers: false
disk_cache_max_size: 0
preferred_interface:
admin_name: YOUR_USERNAME
admin_password: YOUR_PASSWORD
logmask: 0
finish_cmd:
state_cmd:

Remember to change the YOUR_USERNAME and YOUR_PASSWORD variables!!!

Technically we’re ready to launch the server… we just need a good init script. You’re very lucky, I’ll leave you mine. Pay attention to the first variables. You’ll have to change them based on the changes you made during installation. The script should be downloaded, placed in the /etc/init.d/ directory, and its permissions changed to make it executable. Here you’ll find my script.

cd /tmp; wget https://example.com/utserver-init.sh -O utorrent
mv utorrent /etc/init.d/
chmod a+x /etc/init.d/utorrent
update-rc.d utorrent defaults

WEBUI

Before starting the service, let’s properly initialize the Web User Interface. This will let us use our browser to connect to the server, upload a .torrent file, and have the related linked files downloaded while our PC is turned off or inactive.

cd /opt/utorrent/
cp -a webui.zip server/settings/
cd server/settings/
unzip webui.zip -d www
chown -R utorrent:users *

Start the service

service utorrent start

connect to http://yourserverip:19080/gui enter YOUR_USERNAME and YOUR_PASSWORD and have fun!!!