Chinaunix首页 | 论坛 | 博客
  • 博客访问: 845732
  • 博文数量: 116
  • 博客积分: 1472
  • 博客等级: 上尉
  • 技术积分: 1725
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-06 11:45
文章分类

全部博文(116)

文章存档

2015年(1)

2014年(42)

2013年(5)

2012年(19)

2011年(49)

我的朋友

分类: LINUX

2012-01-26 22:59:49

rTorrent + wTorrent Installation Guide For Ubuntu
2010-05-07 17:31

This guide will cover setting up a wTorrent seedbox, it is a highly newbie friendly guide so if you're already familiar with Linux, Debian and rtorrent you should be able to safely skip most of my babbling and just look for the commands and configurations. This guide also works for Ubuntu Hardy/Intrepid. During the initial package selection choose only SSH Server, everything else in this guide should be identical apart from the package list, as you will see below. If using Ubuntu, you will of course skip downloading the Debian .iso, the installation is much the same however.

You will want to get the 'netinst' .iso from this URL (it should be about ~150MB):

http://cdimage.debian.org/debian-cd/4.0_r4a/i386/iso-cd/

Burn and boot. Press ENTER when prompted and follow the on-screen instructions. It's worth noting that if DHCP fails to set up your internet connection (which it should do just fine) you're pretty screwed. If it does fail you'll have to either give up, or work out how to set up your network manually.

If you're not too sure about the partition editor, choose 'Guided - use entire disk'. Be aware that this will erase the entire contents of your drive. Otherwise, you will want a swap partition that is double the amount of RAM that your system has, up to 1024MB, any more is probably a waste. You will need a / (root) partition, this needn't be very large, couple of GBs will do fine. The rest can be allocated as your /home partition if you plan to download your torrents here. If not, either create a dedicated torrent partition or, as in my case, you have a separate drive which you can mount later.

Keep following the instructions, set a root password and a create user, choose a software mirror. Say 'No' to the popularity survey, unless you really fancy it. Install GRUB bootloader and Debian is installed!

After the reboot, log in as root and enter these 2 commands to update your install:

  • apt-get update
  • apt-get upgrade

If you get a kernel upgrade reboot your system with this command:

  • reboot now

Log in as root again and install ssh and sudo:

  • apt-get install ssh sudo

Once that's done enter this to add your user as a 'sudoer' (skip this with Ubuntu):

  • visudo

Now change:

  • root ALL = (ALL) ALL

To:

  • root ALL = (ALL) ALL
  • yourusernamehere ALL = (ALL) ALL

OK, now that that's done you can login remotely and also login and perform any task you want without logging in as root. It will be advantageous for you to log in remotely as you can copy & paste commands and later on, code. Assuming this is going to be a headless server tucked away somewhere like mine, this will be absolutely necessary to administrate your machine. To connect to your machine remotely you will first need to know it's IP address, if you're connecting over a LAN type 'ifconfig' where you will find your 'inet addr'. From Windows, enter this into a program like PuTTy or from Linux, run 'ssh your.inet.addr.here'. Remember, if you set up sudo, you don't need to login as root here but you will need to append 'sudo' to the beginning of every command requiring root permissions.

The SSH server should be running, but just incase it's not enter these 2 commands, which will require sudo:

  • update-rc.d ssh defaults
  • /etc/init.d/ssh restart

Now that you've SSH'd into your box you can copy & paste this rather large list of packages. For DEBIAN:

  • apt-get install apache-common apache2-utils autoconf automake autotools-dev binutils build-essential bzip2 ca-certificates comerr-dev cpp cpp-4.1 dpkg-dev file g++ g++-4.1 gawk gcc gcc-4.1 libapache-mod-php5 libapr1 libaprutil1 libc6-dev libcurl3 libcurl3-openssl-dev libexpat1 libidn11 libidn11-dev libkadm55 libkrb5-dev libmagic1 libncurses5-dev libneon26 libpcre3 libpq4 libsigc++-2.0-dev libsqlite0 libsqlite3-0 libssl-dev libssp0 libstdc++6-4.1-dev libsvn1 libtool libxml2 lighttpd linux-kernel-headers lynx m4 make mime-support ntp ntpdate openssl patch perl perl-modules php5 php5-cgi php5-common php5-sqlite pkg-config screen sqlite subversion ucf zlib1g-dev

For Debian 5.0, apache-common is apache2.2-common, libpq4 is libpq5, libssp0 is libssp0-dev and libapache-mod-php5 is libapache2-mod-php5.

For UBUNTU:

  • apt-get install apache2.2-common apache2-utils autoconf automake autotools-dev binutils build-essential bzip2 ca-certificates comerr-dev cpp cpp-4.1 dpkg-dev file g++ g++-4.1 gawk gcc gcc-4.1 libapache2-mod-php5 libapr1 libaprutil1 libc6-dev libcurl3 libcurl3-openssl-dev libexpat1 libidn11 libidn11-dev libkadm55 libkrb5-dev libmagic1 libncurses5-dev libneon26 libpcre3 libpq5 libsigc++-2.0-dev libsqlite0 libsqlite3-0 libssl-dev libssp0-dev libstdc++6-4.1-dev libsvn1 libtool libxml2 lighttpd linux-libc-dev lynx m4 make mime-support ntp ntpdate openssl patch perl perl-modules php5 php5-cgi php5-common php5-sqlite pkg-config screen sqlite subversion ucf zlib1g-dev

Now you're finally getting somewhere! It's time to install xmlrpc-c which will make rtorrent talk to your wTorrent and vice versa. Enter these commands, one at a time to download, and install xmlrpc-c (you may require sudo for 'make install'):

  • cd
  • svn co xmlrpc-c
  • cd xmlrpc-c
  • ./configure --disable-cplusplus
  • make
  • make install

Now to install libtorrent and rtorrent, I had stability problems with the latest builds on Debian. If you're using Debian I currently recommend the versions below (0.11.9/0.7.9), however I just switched to Ubuntu for completely unrelated reasons and have had great success with the current latest builds (0.12.3/0.8.3 - visit their website for links - ), this also reports total speeds correctly. Remember, you can use TAB to auto-complete file and directory names in the terminal:

  • cd
  • wget
  • tar -zxvf libtorrent-0.11.9.tar.gz
  • cd libtorrent-0.11.9/
  • ./autogen.sh
  • ./configure
  • make
  • make install
  • cd ..
  • wget
  • tar -zxvf rtorrent-0.7.9.tar.gz
  • cd rtorrent-0.7.9/
  • ./autogen.sh
  • ./configure --with-xmlrpc-c
  • **after that command make sure you see "checking for XMLRPC.... OK" near the end of the outputted text**
  • make
  • make install

If at this point you get errors relating to 'curlstack:curl' or anything similar with the word curl, you may need libcurl4, which is not currently in the Debian repositories. To install this:

  • nano /etc/apt/sources.list

Add these 2 lines and then press 'Control O' and Enter to save, then 'Control X' to exit:

  • deb etch-backports main contrib non-free
  • deb-src etch-backports main contrib non-free

Now type these 2 commands to upgrade your libcurl:

  • apt-get update
  • apt-get install libcurl4-openssl-dev

Now rtorrent is installed, set it up. It's settings are stored in your users /home/user/ folder as '.rtorrent.rc'. E.g. - '/home/bob/.rtorrent.rc'. Visit this URL and copy all the information into your .rtorrent.rc (if you're using SSH from another computer, resize the terminal window to avoid single lines being spread across more than 1 line, applications do not like this):

Change it all to your needs, especially the data folder it will download your torrents into, your watch folder (which, when you drop a .torrent file into, will trigger rtorrent into downloading), and a session dir, you will need create these directories yourself with the 'mkdir /path/to/etc command'. Most importantly for wtorrent, add this line in somewhere, as long is it's not commented out with a '#'.

  • scgi_port = localhost:5000

Now it's time to try out rtorrent, type 'rtorrent' into the terminal, if all goes well it should load up and display 2 messages, 'loaded XMLRPC with xxx functions' and 'scgi bound to a port.. blah blah blah'. If not, something has gone wrong. Type 'netstat -np -l' and make sure you see an entry for rtorrent LISTENing at 127.0.0.1:5000.

Now that you've configured rtorrent, you'll need to give ownership over all the directories you've supplied in the '.rtorrent.rc', use these 2 commands on each folder, obviously putting your own username in in place of 'bob' and the full path to your torrent directories:

  • chown bob:bob /path/to/yourdir -R
  • chmod 777 /path/to/yourdir -R

Now to set up lighttpd. Enter this command with sudo to enable your webservers auth plugin:

  • ln -s /etc/lighttpd/conf-available/10-auth.conf /etc/lighttpd/conf-enabled/10-auth.conf

Now to edit your lighttpd.conf:

  • nano /etc/lighttpd/lighttpd.conf

Make sure you have these lines in your server.modules section:

  • "mod_scgi",
  • "mod_fastcgi",
  • "mod_auth",

Now we're going to create a password file, 'cd' into '/etc/lighttpd/' and enter these commands, entering your username and password on the second line:

  • cd /etc/lighttpd
  • user=yourusernamehere; pass=yourpasswordhere;
  • echo $user:XML-RPC:`echo -n $user:XML-RPC:$pass | md5sum | cut -b -32` >> htdigest
  • unset user; unset pass;

We're now going to edit /etc/lighttpd/lighttpd.conf again:

  • nano /etc/lighttpd/lighttpd.conf

Add this to the bottom:

  • scgi.server = (
  • "/RPC2" => # RT_DIR
  • ( "127.0.0.1" =>
  • (
  • "host" => "127.0.0.1", # Ip where rtorrent is listening
  • "port" => 5000, # Port specified in .rtorrent.rc
  • "check-local" => "disable"
  • )
  • )
  • )
  • fastcgi.server = ( ".php" => ((
  • "bin-path" => "/usr/bin/php-cgi",
  • "socket" => "/tmp/php.socket"
  • )))
  • auth.backend = "htdigest"
  • auth.backend.htdigest.userfile = "/etc/lighttpd/htdigest"
  • auth.require = ( "/RPC2" =>
  • (
  • "method" => "basic",
  • "realm" => "XML-RPC",
  • "require" => "valid-user"
  • )
  • )

You're almost done now. The only thing left to install is wtorrent:

  • cd /var/www
  • svn co
  • cd wtorrent
  • mv * ..
  • mv .* ..
  • cd ..
  • rm -r wtorrent
  • touch ./db/database.db
  • chown -R www-data:www-data db torrents tpl_c
  • nano conf/sample.user.conf.php

Edit this to suit your needs, set RT_AUTH to true and put your username and password in RT_USER "**" and RT_PASS "**". Also don't forget to change 'DIR_EXEC' to '/var/www'. You need to save this as 'user.conf.php'. Now run:

  • /etc/init.d/lighttpd restart

Your lighttpd should have restarted successfully, if so open a web browser and type:

Set up an account and then once done, visit:

Log in and everything should be working perfectly!

Now you've done this with your server there's a lot more you can do, especially if your server is at home. For example, mine torrents 24/7, shares my entire music and movie library with the whole network, performs backups with a single command (and a scheduled script once I get around to it) to a hard drive only accessible by root and converts movies to .iso's while I sleep.

阅读(2003) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~