Installing rtorrent + ruTorrent on Ubuntu Server 10.04 LTS

First things first. To give credit where it’s due, I have to link to sharky’s tutorial at filesharefreak.com. Much of my tutorial is copied from there, with a few changes to include my own personal preferences as well as a few fixes that I had to implement for my particular setup.

There’s no question that for Linux users, rtorrent is a fantastic lightweight bittorrent client.  But, if you’re like me, you prefer a nice web user interface (WebUI) for your rtorrent as opposed to its not-user-friendly text interface.  That’s where ruTorrent comes in.  It closely mimics uTorrent’s user interface, and is therefore very user-friendly and very welcoming to Windows users looking to switch to Linux for their torrenting.

Step 1: Accessing Your Server

Should be obvious, but I feel I should include it anyway. If you have a monitor and keyboard connected to your server, of course you can use them. Just log in and proceed to Step 2. Otherwise, you’ll need a way to access your server remotely, be it from across the house or further.

If you’re installing Ubuntu Server, you have an option to install a Secure Shell (SSH) server during the install process. That’s easiest. But if you’ve installed Debian or Ubuntu’s desktop version, you will need to install it (sudo aptitude install openssh-server ) if you haven’t already.  Then it’s just a matter of connecting to your server using a program like Putty if you’re in Windows.  Mac OS X and Linux have SSH built-in, so you can just run it from a command line (ie.ssh <ipaddress> ).

Step 2: Install Necessary Packages

In order to use rtorrent with ruTorrent, you’ll need to install a web server as well as ensure that a few dependencies are met and some tools to compile rtorrent (don’t be scared, it’ll work better, and I’ll explain why in Step #3).  I use Apache web server, some will use lighttpd.  I only chose Apache because my server also serves as a test platform for other web projects (ie. this site and the others listed under “Web Portfolio”) in addition to ruTorrent.

I prefer to install packages via the command line (again, don’t be scared, I’ll explain below) in Linux, especially when I have multiple packages to install, as is the case here.

First, make sure you have a list of current versions of packages in the repositories:
sudo aptitude update

When that’s finished, you’re ready to start installing tools, dependencies and the other packages needed to run your server. First, let’s make sure we have all of the packages that rtorrent will depend on:
sudo build-dep rtorrent

Now we can install the tools to compile rtorrent and the Apache web server we’ll use to access the ruTorrent WebUI:
$sudo aptitude install -y build-essential pkg-config libcurl4-openssl-dev libsigc++-2.0-dev libncurses5-dev screen subversion libterm-readline-gnu-perl php5-cgi apache2-server apache2-utils libapache2-mod-scgi

Where "-y" means that the package manager, Aptitude, will assume the answer will be "yes" instead of asking for confirmation that you want to install these packages. See that list of packages? It’s much easier to type out on the command line than to search and check them off in the Software Center, no? Alright, that’s done.

Step 3: Compile rtorrent

Okay, if using the command line is off-putting, then this is where Linux neophytes get scared.  For those that really don’t want to compile from source, you don’t have to.  You can skip Step #1, install Apache and rtorrent from the Ubuntu Software Center and skip ahead to configure ruTorrent and Apache.  And it’ll pretty much work.  But your mileage may vary because the version of rtorrent in Ubuntu’s (and Debian’s) repositories is compiled with an older version of xmlrpc-c.  You’ll get a warning in ruTorrent informing you of this, and in my case, file sizes of torrents and their files (and, by extension, amount downloaded, uploaded, rate and ratio) were not being displayed correctly.  So, you’ve been warned.

Now, let’s compile rtorrent and its components.  First, libtorrent:
cd /tmp
sudo wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.12.6.tar.gz
sudo tar zxfv libtorrent-0.12.6.tar.gz
cd libtorrent-0.12.6
sudo ./configure
sudo make
sudo make install

So what’s that mean?  Well, in the first line we navigate to a temporary directory, /tmp.  Then we download the source code for libtorrent, extract it, enter the directory containing the extracted files, and the last three lines are where we actually compile and install the application.

Pretty much the same deal for xmlrp-c:
cd /tmp
sudo svn checkout http://xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/stable xmlrpc-c
cd xmlrpc-c/
sudo ./configure
sudo make
sudo make install

Great.  That’s done.  On to rtorrent:
cd /tmp
sudo wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.8.6.tar.gz
sudo tar zxfv rtorrent-0.8.6.tar.gz
cd rtorrent-0.8.6
sudo ./configure --with-xmlrpc-c
sudo make
sudo make install

That wasn’t so bad, was it?

Step 4: Configure rtorrent

Like most Linux applications, rtorrent is configured with a simple plain-text file.  So we’ll have to create that file, and fill it with the requisite settings.  To do that, navigate to the home folder of the user that will be running rtorrent (some create a separate user for this, I found it to be more trouble than it was worth and just run it under my own account now, but this is up to you).  If you’re logged in as that user, simply typing “cd” at the command line will suffice.

So, once we’re in the home directory, we’ll have to create and open the file for editing.  This can be done in one step with Debian and Ubuntu’s default text editor, nano:
nano .rtorrent.rc
Now that the file’s loaded up and ready for editing, let’s get some settings in there. “Chris” is the user that will run rtorrent; edit as necessary for your situation, and do the same for your directories, creating directories as needed (ie. mkdir .rtorrent/session downloads):
directory = /home/chris/downloads
scgi_port = localhost:5000 #Important - we need this for ruTorrent to work
session = /home/chris/.rtorrent/session
schedule = low_diskspace,5,60,close_low_diskspace=100M
port_range = 51515-61234
port_random = no
use_udp_trackers = no
encryption = allow_incoming,try_outgoing
dht = off
peer_exchange = no
#The Following Are VERY Important
encoding_list = UTF-8
scgi_local = /tmp/rpc.socket
schedule = chmod,0,0,"execute=chmod,777,/tmp/rpc.socket"

My settings are pretty basic, but there’s a lot you can do with your configuration file.  Check out this page if you’d like to find out how to automatically move files upon completion, change permissions, set up watch directories, and so on.  It’s all up to you.

Great, that’s done.  You have a fully-functional rtorrent that you can run now.  But we want a WebUI, so…

Step 5: Setting up ruTorrent

First, download it.  Second, we’ll have to edit it so that it can find and connect to rtorrent.
cd /var/www/rutorrent/conf
nano config.php

Now look for the line “$scgi_port = 5000;” and also take note of the following line: “$XMLRPCMountPoint = "/RPC2".” These are vital for allowing ruTorrent to communicate with rtorrent. The values in ruTorrent’s config.php must match up with the values in rtorrent’s configuration file above and in Apache’s configuration.  Which brings us to…

Step 6: Apache

Not a whole lot to do here, we just need to make sure that Apache can allow ruTorrent to connect to rtorrent, and it is also wise to password protect your rutorrent directory on the web server.

So, we’ll navigate to Apache’s configuration files and configure them:
cd /etc/apache2
sudo nano httpd.conf

SCGIMount /RPC2 127.0.0.1:5000 
<directory /var/www/rutorrent/>
AuthName "Log In"
AuthType Basic
AuthUserFile /home/chris/.htpasswd
AuthGroupFile /dev/null
require user chris
</directory>

The First line was referenced in the last paragraph of Step #5.  Those numbers need to match those in rtorrent’s .rtorrent.rc and ruTorrent’s config.php.  You can change them as you see fit (that is /RPC2 can be changed to /RPCx, where x is a positive integer, and the port number can be changed from 5000; in typical practice this would be changed to 5001, or 5002, etc.), but make sure you do it across the board.

The lines below deal with security; password-protecting the rutorrent directory on your web server.  For this to work, you will need to create the .htpasswd file referred to in line 5.  You can do this simply by running the htpasswd command:
htpasswd -c /home/chris/.htpasswd chris

For more information on htpasswd, visit Apache.org.

Next, we’ll have to make sure that SCGI is enabled in Apache, to do this, we simply need to copy it to the correct location:
sudo cp mods-available/scgi.load mods-enabled/scgi.load
and restart Apache:
sudo /etc/init.d/apache2 restart

That’s it!  To run rtorrent, simply type “screen rtorrent” at the command line.  Screen is used so that you can close your SSH session (or continue to use it for something else) while keeping rtorrent running in the background.  For the latter, simply hold “Ctrl” and then hit the “A” and “D” keys in that order (Ctrl+A+D).  rtorrent will disappear but continue to run, to verify this, you can simply type “screen –R” to get it back.  Or, of course, you can verify with your ruTorrent WebUI by typing “http://<server-address-here>/rutorrent” in a web browser.

I’ve had success installing rtorrent on Ubuntu 10.04 Server 32-bit and 64-bit with this method.  I’ve had less success with this version of rtorrent on Debian, so no guarantees that it’ll work.

I believe this guide is complete, but if you do see any omissions, typos, or if you have anything else to contribute, please leave a comment.

Enjoy!

Bookmark and Share

The Universal Network Cable

Universal Network CableTired of having to look for a crossover cable?  Irritated at not having a proper cable to connect to a T1 box?  Misplaced loopback dongle?  Any combination of the above?  It’s no longer an issue.  Save time and money spent searching for or purchasing adapters, cables or dongles with one device that will handle whatever you throw at it.  Need a crossover link?  Just twist the collar and you’ve got it.

It comes in three varieties, requiring one, two, or zero straight-through Ethernet cables to connect two network devices without the need to determine or locate the type of cable needed for hassle-free troubleshooting.

The device speaks for itself, there’s not really much to say aside from the fact that I’m surprised it hasn’t already been made.

Check it out the Universal Network Cable site, or if you’re ready to buy, it’s available for only $25 at Think Geek.

Bookmark and Share

Adding a Network Share To a Windows 7 Library

 

Do you have a directory on file server or a shared folder on another computer that you want to add to a Windows 7 Library?  I did, and I was annoyed at Windows’ inability to add a network path to a Library. 


This is what Windows 7 says when an attempt to add a network share to a Library is made

Libraries require folders to be indexed (or at least capable of being indexed) before they can be added.  I didn’t want to make the entire contents of the folder available offline (indiscriminately making network folders available offline is a good way to eat up hard drive space on your Windows partition).  I’m also using Debian GNU/Linux for my file server, so any features that a Windows server may offer are useless to me.

The trick to making this work hinges on something that the majority of Linux users — and the minority of Windows users –  are familiar with:  symbolic links.  Libraries can be tricked into using symbolic links to network locations that they otherwise wouldn’t use.  To take advantage of this, follow the steps below in order. If done out of order, you may find yourself back at square one.

First, create a new directory.  This is the directory that you would like to trick your Windows Library into thinking is on a local hard drive as opposed to a network share. For example, you may want to create a directory called “Share” on your C: drive (ie. C:\Share).

Next, add this new, empty folder to your Library.  Once that’s been done, go and delete the newly created folder.

Now here’s the trick.  You’ll have to open an “elevated command prompt” – that is, open “cmd” as administrator – like so:


Click on the Windows (Start) button, type "cmd" in the search box…
…right-click on "cmd.exe" and select "Run as administrator" from the menu.

You’ll have to confirm this action if you have a user account with administrative privileges, or supply a password if not.  Once confirmed, you can create your symbolic link by typing the following:

mklink /d c:\Share \\server\Share

mklink” is the command, “/d” is the parameter that tells it that the link to be made is a symbolic link to a directory.  Of course you’ll substitute “c:\Share” and “\\server\Share” for the path to the folder on your own system and network share, respectively.

That’s it!  You should even be able to search within the directory, as per a typical Windows 7 Library folder.

Bookmark and Share

uTorrent and Multi-booting

uTorrentI’ve mentioned before That I often have more than one operating system (OS) installed. I also use uTorrent for my bittorrent needs, and I don’t want to have to be running a specific OS in order to complete my downloads. Because of this, I’ve had to find a way to run the same copy of uTorrent — and have it load all of my torrents — in each OS.

I’ll break it down into a few easy steps.  Start in the OS that contains the working installation of uTorrent.

1. Put uTorrent.exe in a partition or folder accessible by both operating systems (OSs). For simplicity’s sake, it makes the most sense to have a data partition separate from your OS partitions for two reasons: 1) If you ever need to wipe out a system partition, you won’t have to worry about moving your data around, and 2) It will make the rest of the process simpler and sharing between your operating systems will be seamless.  I have my uTorrent folder on drive E:, for example.

2. Run uTorrent.exe. Now Windows will use this copy of the uTorrent executable instead of the one previously installed in your Program Files directory.

3. In your current OS, open Windows Explorer and navigate to %APPDATA%. This is a variable that will save you the hassle of typing the entire path (and remembering the different paths that it points to in different Windows version) into Explorer’s address bar.   There will be a uTorrent folder there.

4. Move the contents of this folder to the folder created in #1. Make sure to get all of the .torrent files for obvious reasons, and get all of the .DAT files, too; these will save uTorrent’s settings.

5. Now when you run uTorrent, it will see all of your .torrent files and continue leeching/seeding as it was before.  Boot in to your other OS and run the uTorrent.exe file and everything will be instantly be running properly there as well; as long as the path to the downloaded files are the same, so make sure the drive you download your torrent data to has the same letter in each Windows installation.

6. From now on, download all of your .torrent files to this new directory (E:\uTorrent in my example) and open them in uTorrent. They will be there when you boot into your other Windows installation. It’ll even work under Wine in Linux, though maybe not if you’re using a https tracker.

Have fun! As always feel free to comment with suggestions and/or corrections.

Bookmark and Share

Enhance Your Windows Experience with UI Add-ons

It seems that in the Linux and Mac communities, Windows is often being bashed for what it doesn’t do while being criticized for having too much bloat.  While I won’t get into the latter claim, I will address the first.  There are, unfortunately, numerous areas where Windows is lacking.  Out of the box, at least.  KDE’s Dolphin file manager allows Linux users to enjoy a tabbed browsing experience within the filesystem for example, and Windows Explorer is lacking that feature.  The old Alt-Tab application switcher does not measure up to OS X’s Exposé, and Flip-3D isn’t much better.  Windows for some reason doesn’t support multiple/virtual desktops (AKA “workspaces”).

Fortunately, there are some quality third-party applications to fill those gaps (and some others) in the Windows user interface.  Best of all, they’re free.  No trials, no ads for “Pro” versions.  Free.

Application Switcher: Switcher

Tired of having to keep holding that Alt key while you tap on Tab until you find your application?  Flip-3D is nicer, but it’s form over function, let’s be honest.  It’s nothing more than a glorified Alt-Tab.  Plenty of eye-candy, and one new functional feature:  the ability to select a window by clicking it.  Wow.

Switcher

Switcher assigns a number to each open window and allows the user to view windows contents (something Flip-3D attempts), but instead of having to cycle through or use the mouse to select a window, all the user needs to do is type the number of the desired window, and Switcher will bring it to the front.  Of course, one can cycle through if they so desire, but the added functions and hotkeys make it unnecessary more often than not.

Bookmark and Share

Installing Windows 7 64-bit with a Key From 32-bit Media

Yesterday I attended the “The New Efficiency” launch event for Windows 7 in Burbank. At the end of the event, Microsoft was generous enough to give away a free copy of Windows 7 Ultimate to all of the registered attendees. Of course, even when something’s free, some people will find something to complain about. In this case it was the fact that the Windows installation media (read: DVDs) only contained the 32-bit version of the OS. This is actually a non-issue, likely something they did just to cut costs. I’ll explain why.

Here are some clues that should tell you that the CD Key provided with the 32-bit disc will work with any 64-bit retail DVD (or, if you unpack an ISO for installation from a USB drive)…

Win7 Cover
Note that the case was originally printed to say that both 32- and 64-bit discs were included.
inside the sleeve
It’s hard to see in this scan, but there are two sleeves for discs. Also note that the requirements mention both 32- and 64-bit systems.

…and here’s some proof that it will, in fact, work:

It’s already been confirmed, on this board and elsewhere, that the key provided with the launch event media is usable for either 32-bit or 64-bit installations, just like any other Windows 7 install key.

The remaining question is whether or not a retail disk will be compatible with your install key. I don’t have the launch event media available to me here to verify, but I’m guessing that it’s actually a ‘retail’ disk image with a ‘limited run’ special disk label printed on it. Checking and comparing the ei’cfgfile contents will verify the truth or otherwise of that assumption, because that file is the only thing which will differ within the disk contents.

There are 3 entries in that file. Most of the discussion to date has revolved around changing the image to a different ‘version’. That’s the first entry in the file. The second entry is “Channel” and if the launch event media differs from retail media that’s where the difference would be, I’m sure. (The third entry is simply a flag to indicate whether or not it is volume licensing media.)

As said, I suspect it’s a ‘retail’ disk you have, so the alternate install retail media should work fine.

Source

Since I do have a disc to confirm, here are the contents of the file in question:

ei.cfg
This is the ei.cfg file from the “Sources” directory on the DVD

It confirms that the DVDs distributed at the launch event are the retail discs.

QED.

Bookmark and Share

“No God” Trend is Crashing Twitter; Deliberately Removed from Trending Topics

too many tweets

It started with a slew of religious folk re-tweeting the phrase “Know God… know peace. No God, no peace.” “No God” then became the #1 trending topic, overloading the site.

No God disclaimer

Twitter’s explanation didn’t seem to get through to many offended Christians who were left wondering how “No God” became such a hot topic.

UPDATE @ 4:15 PST: I wonder if the frequent site overloads are what led Twitter to remove “No God” from the trending topics list?

UPDATE @ 4:50 PST: I think Twitter answered it for me:

Know God?

It appears that Twitter is practicing a little selective censorship. Not good.

Bookmark and Share

Store your Microsoft Outlook Data File on a Separate Partition

Well, now that we’ve got our important data moved to a new partition in case of any OS crashes, re-installations or upgrades, let’s take a look at Microsoft Outlook. Some of us, for various reasons, haven’t switched to a webmail-only experience for e-mail, and Outlook, for all its criticisms, continues to be a popular application for email and appointment management.

So, how can we do for Outlook what we did for the rest of our personal files in the article linked above? The answer is obvious; store Outlook’s data files on a separate partition as well. Here’s how it’s done.

First, export your data.

It’s always wise to create a backup when working with important information. Outlook makes it easy:

Outlook File Menu

Simply click on your “File” menu and choose “Import and Export.” Follow the steps in the images below to create a PST file that Outlook will be able to import in the future, if need be.

Export to a File
Choose File Type
Choose Folder to Export From

Be sure to select “Personal Folders” here. This will include your Inbox, Calendar, Contacts, Tasks, etc. along with any other folders you may have created in Outlook.

Now, choose a location and filename and you’re set:

Save File As

That’s it. Now a backup of all of Outlook’s Data exists. If you’ve created a set of rules for managing or filtering your email, you can export that, too. Simply click on the “Tools” menu and select “Rules and Alerts.” There’s an options button there that will allow you to import or export your Outlook Rules. I suggest saving the file to the same directory as the data folder exported in the steps above.

Import-Export Outlook Rules

Great! Now we’ve backed up all of the important information minus the email account information, but that should be handled automatically in the steps on the next page (to be safe, I would recommend recording that information somewhere as there is unfortunately no export feature for this).

Bookmark and Share

Store Your Data on a Separate Partition

I’ve noticed that in a few recent posts I’ve taken shots at Microsoft, though they were all in good fun. I do use Windows as my primary OS on my main PC though, so I figured I’d add a few Windows tips here and there. This will be the first.

This guide will cover how to relocate your Windows users’ personal files to an already existing non-system partition or hard drive. Any directories or folders created manually by a user won’t be covered for two reasons: 1) It’s impossible to predict every possible configuration, 2) if you created a file or directory, you should know where it is to cut and paste it onto the new drive, and 3) I can’t guarantee that applications won’t have to be reconfigured to find any files that they may rely upon.

First things first: what’s a partition and why would you want to store your data on a partition separate from your operating system (OS)?

A short answer to the first question would be to say that to partition a hard drive is to use software to divide it into various sections that an operating system will use as if they were all unique hard drives. See the below image as an example of what a partitioned hard drive might look like in Windows Explorer:

hard drives in My Computer

Now to answer the second question; it is useful because various data can be kept in separate locations on the computer. In the case of this article, we are looking to keep personal data separate from the OS drive. The main reason for doing this is to avoid the headache of losing all of one’s data when Windows decides, for whatever reason, that it doesn’t want to work anymore. Having to temporarily backup and restore files even when the Windows installation is voluntary is also a chore (never mind the fact that it’s easy to forget a directory or two when everything’s being done at once).

As a user that’s always tweaking, breaking and repairing — not to mention dual- or even multi-booting and upgrading — his system, I’ve done a lot of Windows installs, and with each installation, all of my programs need to be (re)configured, documents and other data need to be backed-up and restored to their original location… it’s a hassle.

Obviously it’s in my best interests to store my data on a designated partition. Here’s how I do it (the steps below are for Windows Vista or Windows 7. For XP, a similar end result can be obtained by using a program called TweakUI to change the system’s “Special Folders.”).

Moving your personal folders to another partition

First, create a new partition (or connect your new hard drive) if you haven’t already. This article will assume a partition already exists, I will a post on partitioning in the near future. What I will say on the subject partitioning now is that one must always back up any important data before starting. There is always a chance that something may go wrong, resulting in a loss of data.

Next, navigate to your home folder. Depending on how you’ve configured your menu, you may be able to just click on your username, or you may need to right-click and choose “Open” if you have set it to display as a menu like I have.

Home folder on the Start menu

Once opened, you should be greeted with a number of familiar-looking directories.

Windows User's Home Folder

Notice that there are separate folders for many of the most common file categories for the typical user. They’re all stored in C:\Users\<username> by default. Did you notice the “C:?” That’s the default drive letter for the Windows system directory. That means the files are stored on the same partition as the OS. Exactly what we don’t want. Okay, so how do we fix this while keeping this home directory useful to applications that use it as a default path for storing or accessing files?

Right-click on a directory that you would like to be relocated. I would suggest at least relocating the “Documents,” “Videos,” “Music” and “Pictures” folders. Internet Explorer users will want to include “Favorites” to keep their bookmarks safe, while Firefox, Safari and Chrome users can use Xmarks to sync their bookmarks online.

Right-click, Properties

Here is a feature first introduced in Windows Vista. On the “Properties” Window for these special folders in the user’s home directory there is a “Location” tab. Click it and you have the ability to painlessly relocate the folders to another directory on your system while preserving the directory structure as far as your applications and Start Menu are concerned. It’s very similar to symbolic links in Unix-like systems.

Directory Location

Use either the “Move” button to navigate to the folder you’d like to use, or just type the location in the provided area. When prompted, select “Yes,” you do want to move all of the files to the new location. It will keep things neater.

That’s it! Your data is now residing happily on a folder separate from your Windows installation. So next time you have to reformat your system drive, reinstall or upgrade Windows for whatever reason, just follow the above steps to relocate the folders from your home directory to the appropriate locations on your non-system partition and everything will be back where you left it in seconds.

Bookmark and Share

Internet Explorer Security Protects You from Opera

I was recently presented with the opportunity to download an evaluation copy of the new Enterprise edition of Windows 7. Of course after installing it, I had to re-download and reinstall my applications.

When it came time to download browsers, like everyone else that uses Windows, I had to use Internet Explorer to navigate to the appropriate website. Upon attempting to download Opera I was greeted with the following screen:
(as always, click the image for the full-resolution version)

Downloading Opera with IE

I know that it’s completely innocent, but one can’t help but be amused, particularly in light of the years-long drama surrounding Microsoft’s inclusion of IE with its Windows operating systems.

Bookmark and Share