Skip to content

Instantly share code, notes, and snippets.

@integrii
Last active April 28, 2023 06:12
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
  • Save integrii/71b2fbbd3c48ec776ee6 to your computer and use it in GitHub Desktop.
Save integrii/71b2fbbd3c48ec776ee6 to your computer and use it in GitHub Desktop.
uTorrent Server (utserver) on Centos 7 (x86_64)
#!/bin/bash
# Took me awhile to figure out how to install utserver on Centos 7 x86_64... Especially with the new systemd subsystem. None of the builds I saw support it - but it will work with a couple symlinks and compatibility packages.
yum install glibc libgcc openssl krb5-libs libcom_err zlib keyutils-libs libselinux glibc glibc.i[36]86 libgcc libgcc.i[36]86 openssl openssl.i[36]86 krb5-libs krb5-libs.i[36]86 libcom_err libcom_err.i[36]86 zlib zlib.i[36]86 keyutils-libs keyutils-libs.i[36]86 libselinux libselinux.i[36]86 openssl098e-0.9.8e-29.el7.centos.2.i686 -y
ln -s /usr/lib/libssl.so.0.9.8e /lib/libssl.so.0.9.8
ln -s /usr/lib/libcrypto.so.0.9.8e /lib/libcrypto.so.0.9.8
mkdir /var/utserver
wget -O /var/utserver/utorrent-server-3.0-25053.tar.gz http://download.utorrent.com/linux/utorrent-server-3.0-25053.tar.gz
cd /var/utserver/
tar zxf utorrent-server-3.0-25053.tar.gz
mv /var/utserver/utorrent-server-v3_0/* /var/utserver/
rm -rf /var/utserver/utorrent-server-v3_0
cat << EOF > /usr/lib/systemd/system/utserver.service
[Unit]
Description=uTorrent Server (8080)
After=network.target
[Service]
WorkingDirectory=/var/utserver
User=root
ExecStart=/var/utserver/utserver
Restart=on-abort
[Install]
WantedBy=multi-user.target
EOF
chown root:root /usr/lib/systemd/system/utserver.service
systemctl enable utserver.service
echo "Browse to http://server:8080/gui and login with user admin and no password."
echo "After logging in, go to settings and setup an admin password."
echo "Want settings? Google utserver.conf for examples..."
@nohnaimer
Copy link

A version 3.3 does not work! On this manual - http://blog.kxr.me/2013/08/stand-alone-utorrent-server-x64-64bit.html everything works, though version Ubuntu 13.04 server.
Just do not understand how to add to autostart daemon on CentOS 7?
Using this script for start restart stop daemon:

!/bin/sh

shell_user="root"
uts_bin="/opt/utorrent/utserver"
lib_path="/opt/utorrent/lib/x86_64-linux-gnu"
pid_file="/opt/utorrent/pid/utserver.pid"
settings_path="/opt/utorrent/settings"
config_file="/opt/utorrent/conf/utserver.conf"
log_file="/opt/utorrent/log/ut.log"

start(){

    if [ -s "$pid_file" ]
    then
            kill -s 0 `cat $pid_file` > /dev/null 2>&1
            if  [ "$?" == "0" ]
            then
                    echo "Err: Utorrent seems to be running, PID `cat $pid_file`"
                    exit 1
            fi
    fi
            echo "Starting Utorrent Server.."
            #su -c "cd $settings_path;$uts_bin -settingspath $settings_path -configfile $config_file -logfile $log_file -pidfile $pid_file -daemon" $shell_user
            su -c "cd $settings_path; $lib_path/ld-linux-x86-64.so.2 --library-path $lib_path $uts_bin -settingspath $settings_path -configfile $config_file -logfile $log_file -pidfile $pid_file -daemon" $shell_user

}
stop(){
if [ -s "$pid_file" ]
then
kill -s 0 cat $pid_file > /dev/null 2>&1
if [ "$?" == "0" ]
then
echo "Stopping Utorrent Server.."
kill cat $pid_file
tail -f /dev/null --pid cat $pid_file
rm -f $pid_file
else
echo "Err: Utorrent seems to be stopped, PID file $pid_file not found or empty"
fi
else
echo "Err: Utorrent seems to be stopped, PID file $pid_file not found or empty"
fi
}
status(){
if [ -s "$pid_file" ]
then
kill -s 0 cat $pid_file > /dev/null 2>&1
if [ "$?" == "0" ]
then
echo "Utorrent seems to be running, PID cat $pid_file"
else
echo "PID file present, but no process with PID cat $pid_file running"
fi
else
echo "Utorrent seems to be stopped, PID file $pid_file not found or empty"
fi
}

case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart)
stop
rm -vf $settings_path/settings.dat*
start
;;
status)
status
;;
*)
echo "Usage $0 {start|stop|reload|status}"
;;
esac

@krasnuydyx
Copy link

@nohnaimer this manual (centos) works fine, your manual is for ubuntu which is not related to current topic.

@nohnaimer
Copy link

nohnaimer commented Oct 14, 2016

Please read the first paragraph of article:
Utorrent has released a 64 bit build for Linux platforms (see details here). The release is built on Ubuntu 12.04 (LTS). The problem is that if you try to run it on a distribution like RHEL/CentOS or any older distribution with old libraries, it will fail because of the newer dependencies like glibc 2.14 and libssl 1.0.0 etc.

But it is better to run something like this: vi /usr/lib/systemd/system/utserver.service

[Unit]
Description=uTorrent Server
After=network.target
# DaemonAfter=readynasd.service
# If your using ReadyNAS comment out above "After=network.target" and uncomment below.
# After=apache2.service readynasd.service

[Service]
# User=utserver
# Group=utserver
ExecStart=/apps/ut/utserver -daemon -configfile /apps/ut/config.txt -settingspath /apps/ut -logfile /apps/ut/log.txt -pidfile /apps/ut/pid
Type=forking
PIDFile=/apps/ut/pid
# -- added below to be less priority -- #
Nice=10
IOSchedulingClass=2
IOSchedulingPriority=2

[Install]
WantedBy=multi-user.target

Copy link

ghost commented Feb 16, 2018

The script runs great but I had issues with the openssl.0.9.8e libraries of course. You need to install the 32bit libssl dependencies to get this to work correctly with the command below.

yum install openssl098e.i686

Here are my build steps. This process works on a clean install of CentOS. Run the commands under the root account.

  1. Install CentOS (7.4)
  2. disable selinux
  3. stop and disable firewalld
  4. yum update the system
  5. Reboot
  6. yum install openssl098e.i686
  7. ./setup.sh (to the path of where ever you put the script)
  8. Go the the IP address and port as pointed out in the echo of the script.

Should work for you. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment