Friday, November 30, 2007

Setting up a dedicated torrent server

What is bittorrent?
If you don't already know, you should stop reading now.

Why would I want to set up a dedicated torrent server?
I live in a country where my only option for English TV/Movies is crap cable with constant reruns of CSI and Van Damme bashers. In my first town here, there weren't even English movie theaters within two hours' travel. Maybe you're in a similar situation. Maybe you are just lazy and never want to leave the house. Whatever the reason, if you already download a significant amount, you may want a torrent server.

Why? Aren't mTorrent and Azureus enough for anyone? Not really.

Desktop torrent clients are ... well ... tied to my desktop. I can't logout. I can't shut down. My user experience suddenly starts crawling because my torrents are blazing down at record speed. Whatever the reason for the slowdown is, I found my desktop experience rather pallid with a bittorrent client. I think most people are in a similar situation, judging by how many discussions there are on the internet about trying to get a lighter client.


So what do we want?
I wanted a headless server that just ran all the time. In fact, it made sense for this server to do double-duty as a file server, as well, since I needed to get the files off of the server somehow.

You will need the following specs:
  • CPU: Whatever you find here is probably good enough. If you add TV-out and a video front-end to your server, like Elisa or MythTV, you'll want something strong enough to handle the load.
  • RAM: More is better, but you don't need 4GB or anything. 1GB will certainly handle everything.
  • Graphics card: You've got to be kidding. It's headless. Get something on-board. If you want TV-out, get a low-end card with well supported TV-out, like the Intel chipsets, SiS, or NVidia. I've had a lot of bad experiences with ATIs video out, but that may not be the case now that ATI has released specifications for their cards.
  • Disks: Big and fast. I can fill a 300GB disk in about three weeks. If I'm downloading a well-seeded Linux distro, I can hit 1MB/sec download, so the disk need to be fast enough to catch up. A big cache is good because the disk will spend a lot of time seeking if you have 6-8 torrents running at the same time. CD/DVD drive is probably only necessary to make installation easy.
  • Network: 100Mb/sec should be enough for just about anyone, but you can go with 1Gb/s if it makes you feels safer. You'll probably bottleneck at the disk drive, anyway.
  • Keyboard: Yes
  • Mouse: No
  • Case: Buy a larger one with space to add drives. Trust me. You'll need them.
  • Remote: If you do TV-out, it's probably a good idea, but I won't tell you how to do that here.

Installation
Buy The parts for about 300Kwon (350USD) and assemble the computer. Temporarily attach a monitor and CD drive so that you can do the install. Download an Ubuntu Server CD. Install the operating system with a LAMP stack. That will make everything easy.

Once the OS is installed, we should add SSH so that we can administer the server remotely while sitting comfortably at a desk. aptitude install openssh-server.

Remove the monitor, stick the server in a corner or closet, and go sit down at your desk. Log in to the server remotely.

Next, we need to add the torrent server. I have used Torrentflux as a server for quite some time. It is mature and works well. I used to have to download and manually configure, but now you can just use aptitude or apt-get to install it. Everything is simple. aptitude install torrentflux.


The installation screens will handle the configuration for you and help you set up the database and admin account.

When you are finished, open your webbrowser and navigate to http://{server IP}/torrentflux to log in. You will probably only need the administration account, but you might consider multiple accounts if you have roommates or a vicious family.

Finalizing the install
You'll need to look at the ports your server has assigned for bittorrents and forward those ports from your router to the server. If you've been bittorenting for a while, you probably already have ports forwarded to your desktop, so I won't tell you how to do that. While you're at the router, you may want to set up a QOS system limiting your up and down rate from the server. Especially look at upload rate, since saturating the upload will kill your Internet browsing.
Starting torrents
There are several ways to start torrents in Torrentflux. The most direct way is to upload a torrent file from your desktop machine. The torrent will be added to the list of available torrents but won't be started by default. You'll need to click on the little green arrow to do that.

The next way to get a torrent is to download it directly from the torrent site to the server. To do this, you copy the torrent download link from a website and click the button. This only works for public trackers. Sites which require a password will need a cookie file installed on the Torrentflux server. See the TF site for instructions on how to do this.

The Simplest way to add a torrent is to use the supplied search sites. Torrentflux will scrape the web page of a major site and return information about your search. Clicking on the link to the torrent automatically adds it to the list of available torrents. I use this method 95% of the time.

Queues
Torrentflux works really well out of the box, but if you want a little extra chocolaty goodness on top, enable the queue engine. It was really unstable for a long time, but they've gotten that fixed now. You can limit the number of active torrents to a good number like six or eight. After that, torrents which are started will join the queue and be next up in line to start once one of the current torrents finishes. To make this work, you need to set a seed limit on your torrents so that they stop automatically. Queues are great when you go on vacation or are away for a few days.
Setting up Samba
I'm not actually going to document this here because there are already a number of really good resources on the Ubuntu site and Ubuntu forums. I will say that, for ease of use, you should set up your share to force read/write as the www-data user by default. This will ensure that there are no permission problems.

If you don't feel like setting up Samba, NFS, or FTP, Torrentflux does offer a simple but effective web interface for managing your torrents downloads.




Happy torrenting!!

References:
  • The Torrentflux site: http://www.torrentflux.com/
  • More about Torrentflux: http://en.wikipedia.org/wiki/Torrentflux
  • The Ubuntu Server Install Edition: http://www.ubuntu.com/products/WhatIsUbuntu/serveredition
  • Installing the Ubuntu Server Edition: http://onlyubuntu.blogspot.com/2007/10/ubuntu-710-gutsy-gibbon-lamp-server.html
  • Installing Samba on Ubuntu: http://ubuntuforums.org/showthread.php?t=202605
  • Installing MythTV on Ubuntu: http://parker1.co.uk/mythtv_ubuntu.php
  • Screenshots courtesy of the Torrentflux website.

Tuesday, November 27, 2007

The Pain of Loss

Last week, our network at work was down for 95% of the time due to a worm infestation that installed a backdoor and countless other pieces of malware. The worm spread to almost every computer in this location and IT's attempts to eradicate it failed every time. The IT department eventually decided to reinstall every computer in the building (except mine, of course) and restore from backups.

It didn't work. The backups were infected, too.

I just watched as the woman who sits next to me sobbed for 15 minutes because the last few weeks' work (at least -- I don't really know the whole time frame) was completely lost and she's going to have to recreate it, probably on her own time. I guess the oldest backups available may be infected, too

The drama is still unfolding, and she's started crying again.

Depression.

Windows XP + untrained IT staff.

Meh.

The autistic nerd in me is just happy that the pain isn't mine.

Sunday, November 25, 2007

Want to Dance?


Pydance is a relatively simple program for Linux that's similar to Dance Dance Revolution. Dance pads are supported, but you can just play wih your keyboard if you like. The game also supports music files from other DDR-like games.

First, install Pydance.
Next, open your Home file browser and choose View -> Show hidden files.
Go into the .pydance directory.
Create a new directory named "songs" with a lower case "s."
Visit a Dance dowload site like this one.
Download songs and drag the folder with the song's name from the archinve manager into the new songs directory in .pydance.
Repeat the downloads until you have several songs.
Optionally, you could search for a free song pack, possibly on a bittorrent site (please respect copyright).
Start Pydance in Applications -> Games -> pydance.

Have fun dancing!

Saturday, November 24, 2007

Concentrating on Writing, not Styling

People who know me know that I'm writing a book (I cringe as I say that, hating the person like me who is always writing a book but never finishing one). Actually, I'm writing two books right now, with two more started but shelved for the time being. I have written over 800 pages between the four books. These are non-fiction, not novels.

I didn't use to be so prolific. I spent all my time farting around with my word processor, making my writing look the way I wanted it to. I wished I could stop fiddling, but I couldn't.

Then I discovered Latex. Latex is touted as a great way for the writer to focus on writing. It looks like this:
\documentclass[12pt,ebook,twoside,final,titlepage]{memoir}
\usepackage{graphicx,color,fancybox,varioref}
\graphicspath{{Graphics/}{Screens/}}%

\title{Making the Network More Secure}
\author{Daeng Bo}%

\flushbottom
\raggedbottom%

\usepackage{makeidx}
\makeindex%

\usepackage{glossary}
\makeglossary%
% \usepackage[Lenny]{fncychap}

\input{Admonitions}
In reality, Latex just shifted my concern from styling to programming. I'd spend too much time trying to figure out how to create a special kind of float or other such nonsense. True, I was more productive than I had been before. My drafts definitely looked great. I mean, they looked like books, not letters bashed out in a word processor. I still felt I was wasting too much time, though.

Then I discovered Lyx, a What You See Is What You Mean (WYSIWYM) front-end for Latex. Well, honestly, I'd tried to use Lyx a few times before, but it hadn't worked out well because I had been stuck in a word-processor mentality, trying to use a crowbar to make everything work the way I wanted it to. My time with Latex broke me of that habit, and moving to Lyx just freed up my mind to concentrate on writing.



I can't style. There's no way to do it. Idon't have to remember commands. They're generated for me. I just type. On a good day (once or twice a month), I can produce 20-30 unedited pages. Most days I write much less, but I do it in my spare time when I get motivated. I end up with great-looking stuff. My only complaint is that it isn't a Gnome application, so it doesn't mesh seamlessly with Ubuntu.



Because I use about a hundred books in my research, keeping bibliographies used to be a pain. Once I started using Pybliographer to keep my collection in a Bibtex database (usable by Latex), I had many fewer problems. Just the other day, though, I ran into a problem with Pybliographer and couldn't overcome it. I was again spending my time with my tools instead of writing. I found Referencer, and am amazed by how much more it does. It's perfect for me since 90% of my refence books are electronic. It also looks up journal articles and automatically fills in the bibliographic information for me. My PDFs even get a preview icon so that I can identify them visually. The only thing it doesn't do is automatically insert the reference into Lyx at the point I'm typing. I can easily work around that. Cut and Paste is my friend! It even tags my documents for when the list gets too long.



Writing with Lyx is too easy. If you write for a living or a hobby, you should look it over.

HOWTO
Install Lyx : This will give you Lyx and the Latex environment
Install texlive-latex-recommended : You will have more Latex options for templates
Install texlive-fonts-recommended : You need extra, typeset fonts
Install referencer

Open the Lyx Introduction and Tutorial under the help menu.
Import your e-books into Referencer.
Start typing.

Friday, November 16, 2007

Why I Use Epiphany Instead of Firefox on Ubuntu

The title explains the premise, I've been using Epiphany for a couple of years and is one of the few changes I recommend making to Ubuntu (some of the others include finding something ... anything ... except OpenOffice.org, changing your photo import program from gphoto to f-spot-import, and using deluge instead of the anemic bittorrent client currently offered). Here are the reasons why:
  1. Epiphany is a Gnome application, so it fits into the Ubuntu desktop. If I were running Kubuntu, I would want to use Konqueror instead of Firefox. Epiphany is the official Gnome browser, in fact. The look is entirely consistent. Firefox does its best to copy the look and icons of the Gnome theme, but it still fails in important areas like UI consistency, menu placement, preferences, etc.
  2. Epiphany uses the same libraries as the rest of Gnome, lowering its memory footprint. Firefox is ultimately an XUL application. When I start Firefox, all those initial libraries need to load, meaning it's slow. Did anyone ever complain that FF was slow? Epiphany uses the Gnome and GTK libraries which have already been loaded by teh GNome desktop. It comes up almost instantaneously and reacts quickly. My memory is low. My memory use for an entire desktop, applets, music, and browsing with 10 tabs usually runs at about 300MB.
  3. Gnome is increasingly being built with this browser in mind. Integration. It was good (in some ways) for Windows' users. The next version of Gnome will see further integration of bookmarks (read Epiphany's bookmarks) into the desktop. Firefox, however, is seeing diminishing development on Linux. Firefox 3 will emphasize Windows and Mac.
  4. Epiphany and Firefox both use the same rendering engine so my pages turn out exactly the same.
  5. Epiphany has most of the same extensions as FF.
  6. It's Free software.
  7. Added Later : Epiphany doesn't do anything except browsing. RSS feeds are handled by the system's RSS reader. HTML source opens in the HTML reader. Very Unixy, that way. This helps keep the codebase cleaner and make it easier to squash bugs.
I wish Ubuntu would make Epiphany the default browser, but that will alienate many switchers who are used to FF on Windows.

Added Later : I have a video I made showing how much faster Epiphany is on my machine. After I made it, I realised that Epiphany had several extensions loaded while FF had none. That makes the difference even more amazing. I'll post the video this evening.


OK, so this took a lot longer than I planned. Both applications were loaded, closed, given a bit of time to flush, then loaded again. The time is for the second loading.

Monday, November 5, 2007

Why Ubuntu Doesn't Work Out For Some People

Using Ubuntu is a compromise in many ways. Although it's true that Linux supports more hardware than Windows XP (or especially Vista, at this point) does, much of the odd hardware on desktop systems isn't supported or is only supported partially. Many pieces of hardware that ARE supported require some setup to get running. This gets remarkably better with each release, but it will likely be true for the foreseeable future.

The capabilities of Ubuntu are also different than Windows XP or Vista. When a Windows game player/user buys a new computer, he researches whether Vista or XP better meets his needs and what software will work with it. There is a LOT of Win98 software which doesn't work well or at all in XP. The same is true for XP software in Vista. If this user absolutely needs XP to play a game or runs Win98 in a virtual machine in order to get that one piece of software to run, there's no way he'll buy an OS and go through the pain of installing it when he knows that OS won't meet his software needs.

So that means the very first thing we need to do, long before installing, is evaluate our needs in both hardware and software support. If you NEED to use the scanner you have which isn't on the supported hardware list, you're going to be disappointed and leave quickly. If you're married to a piece of software and won't learn or can't use another piece, you're going to immediately begin trying to shoehorn a piece of software into Ubuntu when the software was never meant to run on the OS. You'll be frustrated and leave soon, as well.

When we have a good understanding of what hardware and software we intend to use and whether it's supported or not, the installaion process often become trivial.

I'm going to say something that will sound a little silly when I write it, but which many people miss. Ubuntu is best at what it is set up to do. That means that using the default applications is easier and better supported than using some new and different one you heard about in the forum. Ubuntu works well with hardware which is recommended and supported out of the box.

Life gets even easier if you buy your system pre-installed on 100% supported hardware from vendors like System76 and Dell.

Right now, Ubuntu doesn't play Windows games well (without a ton of work). It doesn't automatically connect and configure itself to your company's Active Directory network. MS Office compatibility is 95%. Some (few) websites refuse to work well with Firefox. Some codecs and DRMed material will NEVER play. There are very few options for video chat in Ubuntu at this point. You begin to truly understand the need for open formats and hardware specifications when you move to Ubuntu. You will hate DRM.

Your workflow will have to change once you move to Ubuntu. You will have to learn some new programs and new ways of doing things. Some things will be easier and some will take twice as long.

What Ubuntu DOES offer is hassle-free work once you are set up on it. Your workflow can remain the same for years without having to worry about downtime, reboots, or malware. If you don't upgrade the next LTS version of Ubuntu, you can have three years of solid work under your belt and cry every time you have to maintain a Windows machine. If you like just getting work done and have a stable environment to do it in, Ubuntu is a joy.

Or you could get a Mac and hand your wallet over to Steve. That works for a lot of people, too. Because the hardware and almost all software come from Apple, everything works together well.

How do I play AAC files and streams?

You will need to make sure you have faac / faad installed in order to decode the files / streams. Make sure you have the other restricted codecs installed, as well.

When you finish the codec installation, check your ability to play AAC (without DRM) streams with this link. The stream may take a while to get going. Just be patient.

Uninstalling iTunes and Wine

I recently saw a problem where a new user installed Wine (a Windows compatability layer) so he could run iTunes. If you want to do it, too, you can foolow the directions for iTunes on Ubuntu just to spite Vista. In the end, though, he didn't have working sound and didn't want to take up space on his hard drive.

Removing iTunes via the uninstaller didn't work for him, either, and removing the Wine application didn't clean up his menu. He was understandably frustrated, and thought his only choice was to go in and manually remove system files. Here's my advice to him (or you, if you're in this position).

Before you delete files manually in the system area (always a bad idea for a new user), go to System -> Administration -> Synaptic Package manager.

Supply your password In the left pane, click to view packages by "Status" and choose the "Not installed (residual config)" section. You'll find Wine in there.

Click on the square next to the wine package and choose "Mark for Complete Removal." This will remove all the configuration files which aren't removed by default (so you don't have to set everything up again if you reinstall). You won't have those system files anymore.

Next, for your menu, open Places -> Home and in the View menu, choose to "Show hidden files." Enter the .config/menus/applications-merged area and delete anything that starts with "wine." Your wine menu entry should be gone now.

This basic procedure will work for any stubborn application which refuses to disappear from your system and your menu.

p.s. Rhythmbox is a good replacement for iTunes and has the bonus of being the default player in Ubuntu. If you don't like RB, I understand Songbird is excellent.

Other I' Been to Ubuntu Stories

Related Posts with Thumbnails