Headless uTorrent Linux server in OpenVZ

By , 2010-06-13 21:10

Yes, I know, another Linux post. What can I say, this is what I do these days.

I’ve been running a Windows server in a kvm VM just to be able to run uTorrent. This was overkill, had a crazy amount of overhead, and was unstable (downloading to a share on my Samba server). Today I decided to attempt a more efficient solution: uTorrent in Wine. (Yes, there are other BitTorrent clients, and even… NATIVE Linux clients, but I’ve found none of them match the speed of uTorrent for my connection except for kTorrent. However, I don’t have an Android and/or iPhone app to remote control kTorrent.) Wine is a supported platform, according to the uTorrent website, however I wanted to run it on a headless OpenVZ container, and not on a standard desktop Linux distro. Should still be pretty simple, but knowing me, I might forget something next time I try and set this up, so I’ll document it here.

  1. Create a fresh VZ container. I used the Proxmox Debian 6.0 (squeeze) – standard i386 template.
  2. Edit /etc/apt/sources.list to point to a fast mirror in Canada (iweb!)
    deb http://debian.mirror.iweb.ca/debian squeeze main contrib non-free
    deb http://debian.mirror.iweb.ca/debian-security squeeze/updates main contrib non-free
  3. run an apt-get update && apt-get upgrade
  4. apt-get install wine sudo xterm openbox tightvncserver
  5. adduser matt
  6. add google repo: http://www.google.com/linuxrepositories/apt.html
  7. install Google Chrome
  8. wget http://download.utorrent.com/2.0.2/utorrent.exe
  9. From another PC: ssh -Y matt@openvz-container
  10. wine winecfg
  11. run vncserver and set a password.
  12. run wine utorrent.exe
  13. Enable Web UI

Next steps:

  1. Set up Dropbox for easy adding of torrents: http://wiki.dropbox.com/TipsAndTricks/TextBasedLinuxInstall
  2. Make uTorrent and VNC server run on container startup*
  3. Create a VZ mount script so that torrents download outside of /vz area.

* For this I used a cool script obtained from http://www.abdevelopment.ca/blog/start-vnc-server-ubuntu-boot :

  1. Modify your ~/.vnc/xstartup to start the programs you want (gnome-session, lxde-session, utorrent, etc.)
  2. Save the following script as /etc/init.d/vncserver. Change
    export USER="mythtv"

    to the user you want to run the VNC session for.

#!/bin/sh -e
# Provides:          vncserver
# Required-Start:    networking
# Default-Start:     3 4 5
# Default-Stop:      0 6
# The Username:Group that will run VNC
export USER="mythtv"
# The display that VNC will use
# Color depth (between 8 and 32)
# The Desktop geometry to use.
# The name that the VNC Desktop will have.
OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
. /lib/lsb/init-functions
case "$1" in
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
log_action_begin_msg "Stopping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
$0 stop
$0 start
exit 0

For more info, see the source link.

2 Responses to “Headless uTorrent Linux server in OpenVZ”

  1. Andrew Berry says:
    Google Chrome 5.0.375.70 Google Chrome 5.0.375.70 Mac OS X  10.6.3 Mac OS X 10.6.3
    Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.70 Safari/533.4

    Instead of uTorrent, take a look at http://deluge-torrent.org/ – it’s pretty awesome.

    • Matthieu says:
      Firefox 3.6.12 Firefox 3.6.12 Mac OS X  10.6 Mac OS X 10.6
      Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20101026 Firefox/3.6.12

      Thanks, finally did switch to Deluge. Much better.

Leave a Reply


Custom theme by me. Based on Panorama by Themocracy