Creating a remote seedbox / mediabox / webserver from an old PC

I know a lot of people have covered this, but I thought I would share my process behind creating my little multifunctional webserver. I had an old tower that I wasn’t really using. It has an Intel chip (Celeron possibly?), 2G of memory, and 2 hard drives [50GB and 500GB]. I also have a decent Nvidia video card with DVI output. I originally just used it as a mediabox. I had it hooked up to my TV, I ripped Netflix movies on my OS X machine using handbrake into an AVI format, then I put them on this system [which is running Ubuntu] and played them using VLC. This was all well and good, but I didn’t like the idea of having a mouse and keyboard hanging around all the time. So I turned to VLC’s command line interface. After playing around for a while, I was able to get the http interface working. I created an alias in my ~/.bashrc as a little macro :

alias vlcrc='export DISPLAY=:0 ; vlc -I http --no-media-library'

** The DISPLAY=:0 may or may not be necessary to get your video card to display to the attached monitor or TV **

After this, I setup SSH for Ubuntu. Then I gave the Ubuntu machine a static ip address [192.168.0.100] through my router’s admin interface [instructions depend on router, GIYF]. Now, from my laptop connected to the same network over Wifi,  I am able to SSH into the mediabox, and run something like this:

vlcrc There_Will_Be_Blood.avi

Then I can open up Firefox and go to this URL:

http://192.168.0.100:8080/

and I am presented with this beautiful javascript interface:

vlc_interface1

It allows you to control everything in your VLC instance like volume, position, fullscreen, pause/play, and etc just like a remote control. The coolest thing for me was that I could control this with my G1 :) If you try this and get a 403 error, you need to configure your .hosts file. Look here : http://www.videolan.org/developers/vlc/NEWS and do a browser search for ‘.hosts’ to see the instructions. You just need to add IPs of computers that want access to the http interface to a whitelist. I just added a bunch of IPs between 192.168.0.101 and 110 b/c I knew my laptops would never get assigned anything out of that range. By this point, I was able to hide the PC behind my TV and not worry about connecting a mouse and keyboard to it. I was able to pick up a DVI to HDMI cable for 10 dollars at Optimized Cable. They are cheap, but adhere to the HDMI 1.3b standard and as long as they are 6 feet or under, you shouldn’t be able to tell the difference between these and the expensive Monster cables.

From here I started to setup the Torrent side of the box. Ubuntu now comes with Transmission which is arguably one of the best clients around. To save yourself from problems later on, make sure it is upgraded to something over 1.5. If you need to update, go to getdeb.net and get transmission-common and transmission-gtk. Download and install them in that order. After you run it, you can go to Preferences –> Web and setup the web interface. I set mine up on port 9091 and then went to this URL from my laptop:

http://192.168.0.100:9091

You are then presented with a cool interface for uploading, controlling, and monitoring your torrents:

transmission_interface

This was really helpful but I soon wanted a little more functionality. Wouldn’t it be cool if I could control this from anywhere on the net? Of course. For that, I needed to make this computer visible to net.

The thing that makes this part difficult is the way in which most residential users access the internet. As you may know, accessing a domain name, like datasingularity.com, requires a DNS lookup to find the IP address that the domain is referring to. The problem is that most people don’t keep the same IP address for very long. Much like DHCP on your router, your ISP often assigns you different IPs when you connect to their network. This is called having a dynamic IP as opposed to having a static ‘non-changing’ IP. Since your IP is not always the same, registering a domain for your current IP in some nameservers may not last long. If you are not on a business network and don’t know if you have a static or dynamic IP, we can just assume that you have a dynamic IP. That is why you need the DynDNS service. They constantly update your DNS information for you. You just install a client on your webserver and it tells their service when your IP changes. Kick ass.

You can get a free domain like mydomainname.homelinux.net, or you can pay for a custom one. I went ahead and signed up then registered a free domain. I then followed the instructions at this informative link : http://mexpolk.wordpress.com/2008/01/29/ubuntu-gutsy-dyndns-client-setup/.Then I went to this link :
http://www.portforward.com/routers.htm to set up port forwarding on my DLink DI-604 ethernet router. The first port I set up was port 22. This now allows me to SSH and SFTP to my home computer. Yessss. Then I forwarded the 9091 port to get to my Transmission web interface. If your router supports it, you can forward from port external 80 to port 9091 internal, that way, you can just go here:


http://mydomain.homelinux.net

and it takes you straight to the interface! Otherwise, you need to forward 9091 external to 9091 internal and go here:


http://mydomain.homelinux.net:9091

If you want this to be a regular webserver at the same time, it is best to leave port 80 clear and just use 9091. You have to ensure a few things in your Transmission client. Make sure that you go to Preferences –> Web tab and set it up to require a username and password. You don’t want anyone on the net to just go in and mess with your torrents! Then make sure you disable the IP whitelist so any IP can access it. I think it is just a checkbox somewhere in the Preferences –> Web tab.

I am currently in the process of creating a Rails web application to be served locally. It basically holds all the metadata for my media [tied to imdb web service] and lets me browse my system from another web browser on the same network. I can then click a movie or TV show to play it. It launches a VLC process and the HTTP javascript interface in a new browser window! Not done yet but will keep anyone interested updated.

I am somewhat of an idiot when it comes to security, so anyone please chime in if you see any obvious problems here. Any comments, tips, or criticisms are appreciated.

7 comments ↓

#1 Michael Miceli on 07.16.09 at 8:59 am

Hey man,
This gave me some great ideas for our server. DynDNS is awesome. This blog is great for ideas!

#2 benjamin on 07.16.09 at 9:05 am

Thanks Michael, glad you like the site. If I am not mistaken, I think I got the initial inspiration from yall’s apartment.

#3 Ernesto on 08.11.09 at 6:54 pm

Excellent post! Thanks for sharing this! I tried to stream media from my laptop to my xbox with no success so I gave up, but this post gives me hope. I’ll try to set up something similar next weekend :)

#4 Seedbox on 10.14.09 at 1:20 pm

Interesting article, I will try this out

#5 Sam on 05.31.12 at 3:59 am

Truly inspiring! Thanks for sharing this

#6 john on 01.21.13 at 2:41 am

hi

#7 Dhruv on 06.08.13 at 10:31 pm

DynDNS change the ip address immediately? But propagating DNS takes some time. So is this solution effective?

Leave a Comment