全部博文(116)
分类: LINUX
2012-01-26 22:59:49
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:
If you get a kernel upgrade reboot your system with this command:
Log in as root again and install ssh and sudo:
Once that's done enter this to add your user as a 'sudoer' (skip this with Ubuntu):
Now change:
To:
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:
Now that you've SSH'd into your box you can copy & paste this rather large list of packages. For DEBIAN:
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:
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'):
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:
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:
Add these 2 lines and then press 'Control O' and Enter to save, then 'Control X' to exit:
Now type these 2 commands to upgrade your libcurl:
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 '#'.
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:
Now to set up lighttpd. Enter this command with sudo to enable your webservers auth plugin:
Now to edit your lighttpd.conf:
Make sure you have these lines in your server.modules section:
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:
We're now going to edit /etc/lighttpd/lighttpd.conf again:
Add this to the bottom:
You're almost done now. The only thing left to install is wtorrent:
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:
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. |