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:
Then I can open up Firefox and go to this URL:
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:
You are then presented with a cool interface for uploading, controlling, and monitoring your torrents:
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:
and it takes you straight to the interface! Otherwise, you need to forward 9091 external to 9091 internal and go here:
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 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.