First and foremost, there are a few issues I would like to highlight.
- This guide is not targeted for a total newbie, however, I wont stop newbies to try it. Its a good learning experience
- Azureus requires Java, and Java eats resources more. So, you'll need a box with around 200Mhz processor with more than 128MB RAM
- The webUI of Azureus is a simple UI for starting/stopping downloads and uploading .torrent files, we will depend mostly on the TelnetUI for adjusting configurations
- Don't use the java that provided together with Fedora (GCJ) , because it eats more system resources. Use Sun's JRE.
- English is not my first language. Pardon me if theres mistakes all over the place.
I believe some of you have heard about Torrentflux web based torrent client. Why I didn't choose it for this guide? Well, my answer is, Torrentflux is not advanced enough. One of its major disadvantage is the unavailability of encryption. At my place, the largest and cheapest ISP which monopolize the market shape torrent traffic. Therefore, I needed the encryption support for my torrents.
Now, lets start hackin'
Step 1 : Installing The OS
Firstly of course, we need to install the OS. In this case, Fedora. The main point here is to install Fedora with the least packages, and without the Xserver. You also need to do some proper partitioning of the harddisk to give space for your downloads. My suggestion of a partitioning scheme is like this
2-4GB partition for /
A swap partition (people usually suggest the swap size is 2*(your RAM) and no bigger than 1GB)
A partition as big as you can for /mnt/torrentdownload/
During the package selection, unselect GNOME, KDE, X11, and anything related to GUI. SSH server is a must, don't unselect it. crond is aslo needed. To save you from future trouble and for future customization, I recommend installing the development packages and text-based internet applications.
Set up the networking and allow SSH through the firewall. I would also recommend disabling SElinux because it might sometimes causes weird errors with some applications (If you're sure what you're doing, its okay to enable it). And lets assume the computer thats going to become the dedicated box is using IP 192.168.1.2
After installation and reboot, you'll be greeted with a terminal login screen. Login as root and proceed to next step. You can also login remotely through SSH (or for windows users - puTTY)
Step 2 : Installing Sun JRE and Azureus
As I was saying, the GCJ eats resources a lot (at least that what I experienced with it). So, you will need to install Sun's JRE. Install the Sun JRE following this FedoraSolved guide.
Now is to install Azureus. There exist a package for Azureus in Fedora Extras, but I personaly prefer installing from the official Azureus tarball from Azureus's website. So, I'll will guide through its installation and setting up based on the Azureus tarball. You can just simply
yum install azureusbut you might need to modify some of the steps below in order to make it to work for this purpose.
First, create a new user with the name "azureus" and set a password for the user.
adduser azureusSwitch to the user
passwd azureus
su - azureus
From a different computer, get the latest Azureus linux tarball here. SCP it to the box using the scp command (assuming you download the tarball in the home folder)
scp ~/Azureus_2.5.0.0_linux.tar.bz2 azureus@192.168.1.2:/home/azureus/
For Windows user, you can copy the tarball to the box using WinSCP
Back to the box. Untar the azureus tarball and change into the directory
cd /home/azureus/ #just in case
tar xvf Azureus_2.5.0.0_linux.tar.bz2
cd azureus
Back to the different computer, goto this page and download commons-cli.jar and log4j.jar. Those two files are required for console/telnet UI to work. Then, SCP it into the extracted azureus folder.
scp ~/commons-cli.jar ~/log4j.jar azureus@192.168.1.2:/home/azureus/azureus/
To the box again, create a file named azureus.pl and a file named start_daemon.sh in /home/azureus/azureus/ . The content of the files are
===== azureus.pl =====
#!/usr/bin/perl
# http://www.azureuswiki.com/index.php/DaemonizedAzureus
use POSIX 'setsid';
open STDIN, "/dev/null";
open STDOUT,">/dev/null";
open STDERR,">/dev/null";
exit if fork > 0;
setsid;
exec("java -jar Azureus2.jar --ui=telnet");
==== start_daemon.sh ====
#!/bin/bash
# this script will check whether azureus is running
# or not and start it if it doesnt
UP=`ps ax|grep Azureus|grep -v "grep " -c`
if [ "$UP" == "0" ];then
cd /home/azureus/azureus
./azureus.pl
fi
Set execute permission for both scripts
chmod +x azureus.pl start_daemon.sh
Now , technically, Azureus have been installed and can be run directly by executing the start_daemon.sh. You can test whether it has run or not by
telnet localhost 57006to enter the telnetUI. Type "help" in the telnet session for help on how to use the telnetUI. For starter, lets set the default download path and the listening port for Azureus using the telnetUI.
set General_sDefaultSave_Directory /mnt/torrentdownload/
set Core_iTCPListenPort 31234
set UDP.Listen.Port 31234
Exit the telnetUI by typing "logout". Kill the azureus process for now.
kill `ps ax|grep Azureus2|grep -v "grep"|awk '{print $1}'`
Now, get the AzhtmlUI plugin from here and SCP it to the box.
scp ~/azhtmlwebui_0.7.2.jar azureus@192.168.1.2:/home/azureus/
Create a directory named azhtmlwebui in the plugins directory and move the plugin file there.
mkdir -p /home/azureus/azureus/plugins/azhtmlwebuilets disable firewall for now to test the htmlUI
mv ~/azhtmlwebui_0.7.2.jar /home/azureus/azureus/plugins/azhtmlwebui/
su -c '/sbin/service iptables stop'
Now run azureus and from a different computer , open a web browser and test the htmlUI by opening http://192.168.1.2:6886 . If the htmlUI running, you have successfully installed azureus. And don't forget to chmod /mnt/torrentdownload/ to 755 to allow users to write into it.
chmod 755 /mnt/torrentdownload/
Finally, is to set a the cronjob for checking whether azureus is running or not and start it if it doesn't. The technique is simple. Just run
cron -eand add this line into the cron task list
* * * * * /home/azureus/azureus/start_daemon.shSome of you might be asking why I didn't use an init script for this?. My reason is, if just somehow azureus crashed, it will be restarted automatically.
Alternative to set the configs
Some people might sees Azureus is pretty hard to be set through telnetUI. You can, as an alternative, use Xnest to run a remote X server and let Azureus' GUI rendered there.
Install Xnest in a computer that have X installed, disable firewall for a while and start it using
Xnest -ac :1
Then, at the Xless box, export the DISPLAY variable pointing to the remote Xnest in this case, we assume the IP is 192.168.1.3
export DISPLAY=192.168.1.3:1.0
Start Azureus by executing the provided azureus startup script from the tarball and the display will be redirected to the remote Xnest. You can set the options easier this way.
Step 3 (optional): Set Apache to host the downloaded files through HTTP
This step is easy if you only want to host the files. Install apache by running this command
yum install httpdor installing it beforehand during the OS installation.
Then, create a symlink in /var/www/html/ that points to /mnt/torrentdownload/
cd /var/www/html/
ln -s /mnt/torrentdownload/ files
Start apache by running
/sbin/service httpd start
You can set apache to start on boot by running
chkconfig httpd on
If everything is done correctly, you can enter the directory listing by pointing your web browser to http://192.168.1.2/files/
Step 4 (optional): Set up apache mod_proxy to open the htmlUI through apache
You might want to redirect the AzhtmlUI to be displayed at http://192.168.1.2/azureus/ . It is easy to do that using Apache. Edit your /etc/httpd/conf/httpd.conf and add these lines at the end of the config
ProxyRequests Off
ProxyPass /azureus/ http://127.0.0.1:6886/
ProxyPassReverse /azureus/ http://127.0.0.1:6886/
Restart apache and you're done. However, this method have a little bug. You MUST add the trailing slash at the end to enter the redirected page. http://192.168.1.2/azureus will not work properly but http://192.168.1.2/azureus/ will.
Step 5: Firewall
Last by not least, the firewall. You can choose to disable firewall altogether if you want. But to those paranoids, you might want to turn it on.
You can set your firewall using system-config-securitylevel or using Webmin. For the hardcores, you can edit the firewall script directly at /etc/sysconfig/iptables . I'm not going to cover about setting up the firewall here, it might make this article too long. Basically, allow port 80/TCP, 22/TCP, and 31234(your azureus port)/TCP+UDP .
For those who uses a router, goto PortForward.com for guide on how to forward TCP/UDP ports for your router.
Finish
Your dedicated Azureus box is now up and running. This box, besides for torrenting, you can also modify it to provide other services, eg: file hosting, media server, etc. Let your imagination go wild and enjoy~
If any of you spotted any mistakes in the HOWTO, please inform me and I'll fix it.