Since I recently stopped using an old and dented Macbook Pro that was otherwise perfectly working as a computer, I tweeted about having turned it into a media, file, and Bittorrent server. I got a lot of responses asking for my setup, so here’s a guide for turning a Mac that would otherwise gather dust in disuse into a useful server.
My primary demands were gathering content from the internet through FTP and Bittorrent, serving them up to the Macs and Playstation 3 on the network through streaming, and function as a secure public-facing server so I can log in and grab some files when I’m on the go.
I’ve divided this post into three sections, dealing with getting stuff, serving up stuff, and all the nice other things you can do with an always-on Mac. Note: I will not be liable if you melt, damage, or hurt your old Mac in the process of following this guide.
I mostly grab (entirely legal, of course – ahem) torrents from the web when it comes to getting new video entertainment, but I also have a few friends with internet-facing Mac servers that share their anime collections. It’s excellent to have this kind of on-demand content available, as my small Mac server has a pitiful 80GB drive.
I’ll just briefly touch on my Bittorrent setup, which involves only Transmission. I’ve tried a dozen of Mac Bittorrent clients in the years, and Transmission has matured to a point where it’s the best option out there. Its killer features for this particular usage scenario, however, are its powerful web interface and its folder-watching. The latter is very simple: you set up a folder (I’ve chosen the ‘Drop Box’ that all Macs share when file sharing is enabled) and Transmission will automatically open .torrent files that are copied into it. Note that you need to enable automatic transfer starting in Transmission’s preferences for this to work smoothly.
The former is particularly neat, though. Transmission’s web interface (formerly the stand-alone application ‘Clutch’) lets you add new transfers by uploading a .torrent file or by passing a URL to it, manage all your transfers, and even set some minor preferences like upload and download speed.
In 2003, the DLNA was founded to facilitate the creation of a standard for ‘configuration-less’ sharing of media between devices. Unfortunately, as far as I am aware, no current computer operating system supports playing back content that’s shared through DLNA-standard UPnP network sharing out of the box.
On the other hand, if you have an Xbox 360 or a Playstation 3, they will detect UPnP-using media servers on the network and allow file browsing, movie and music streaming and file viewing transparently (provided there’s adequate bandwidth available). On the server end, this requires a modicum of horsepower to transcode (re-encode) movies as they are served. Networks like Youtube utilize massive server farms for this, and it’s a well-known fact that ‘realtime’ video transcoding can be heavy on even modern computers.
My first-revision (2006) Macbook Pro at 1.83 Ghz does transcoding quite well. I suggest trying out how your Mac handles it, as your mileage (read: heat) may vary.
I use PS3MediaServer for sharing my stuff with my Playstation 3, which is an open source and cross-platform UPnP media server (which, despite its name, also works just fine for an Xbox or other compatible systems), but I’ve also had great experiences with Nullriver’s Medialink. Medialink is much more Mac-like and is far easier to navigate from a networked device, but isn’t free. When it comes to playing back video content on non-UPnP playing devices like my laptop or other computers, I browse the shared Downloads folder and play the files in Quicktime. In case you’re using Front Row, making an ‘alias’ of your shared movie folder lets you browse it right from the Front Row interface as well.
To do this, just create an alias of the shared folder and copy it to your own Movies folder. The same works for Music and Pictures, as far as I know, although shared iTunes libraries work much nicer for music.
If you are wondering why I don’t use iTunes network sharing for video, it’s because I have a lot of videos in formats that iTunes doesn’t ‘understand’ out of the box. With Perian for Quicktime, it plays them all back flawlessly, and this also works nicely in Front Row. Hence I can play back any type of video in Front Row with Perian, without having to worry about formats like in iTunes.
I’ve also been looking into a solution to watch videos anywhere on the iPhone, but since this ties into using a VPN gateway, check out the last bit of the ‘Nice extras’ section for a brief look at that.
As I wanted to turn a laptop into a server, I was not to keen on wasting a lot of space and energy by keeping it opened in my server shelf with its screen on. A cat might jump on the keyboard, and I was intending to interact with it using Screen Sharing and SSH, anyway. Few people know that the Macbook Pro (and also the Macbook) has been engineered to run with the lid closed. If you close the laptop and attach a keyboard, display, and mouse, the unit will spring into action and allows you to do regular work. However, there’s a precaution I use to make sure the laptop doesn’t toast itself.
(Incidentally, my first 2006 Macbook Pro ran extremely hot and literally melted itself. It looked like a Photoshop ‘wave’ filter had been applied to it. It was subsequently sent to Cupertino with all my data on it, and it took me three months to get a replacement unit that wasn’t from the same serial number range — yes, I insisted.)
For a few bucks, you can get iStat, the popular computer statistics widget, as an iPhone app. The interesting thing is that Bjango, the developer, provides a server application so you can monitor all your computers’ statistics from your iPhone. For all Macs, this also shows you information like temperature indications of the CPU and hard drive. While keeping an occasional eye on it was good enough for me — even with recent hot summer days, the maximum temperature never exceeded 72°C, which is perfectly normal — I wanted to make sure that a glitch didn’t pump up the machine to huge resource usage and forced it to shut down or melt itself.
I don’t want expansive temperature monitoring solutions, though. I used to use SpeedIt to monitor the temperature levels and run a script when it exceeded a particular value or fell to zero (and other obvious errors), but lately I just set up machines with Temperature Monitor, which has support for sharing temperature sensor readings over the network, Growl (and thus, push notifications on your iPhone with Prowl (iTunes link) or direct email notification) and other neat features. Who knows it might save me from an overheating Mac laptop server once.
Speaking of laptops: I keep the lid of my Macbook Pro closed, as I mentioned. For this, I’ve used InsomniaX for the last 2 years without any issues (in fact, my little laptop server runs the pre-release Snow Leopard build, and it works just fine on that as well). It basically prevents your Mac from going to sleep, even when it’s called to do so by the laptop lid sensor. Again, keeping an eye on the heat is recommended.
A neat extra with having a server are all the possible services you can run. You can opt for a Mac OS X Server license, which is expensive and still rather hard to set up if you’re not a system administrator for a living, or just download some apps that let you get some of OS X Server’s functionality. For instance, you can host websites on your Mac, or make a VPN gateway so you can log into your local network when you’re away from home (I mentioned having this in my Packed post).
A VPN gateway is nothing more than a server that helps you securely get on to your local network from anywhere. It routes your network traffic through an encrypted ‘tunnel’ which — in my case — ends at the little helpful Mac server. If you combine this with Air Video, a Mac server and iPhone app, you can even watch your shared movies anywhere where you can get a data connection going. It’s quite pleasing. If you know other software that can do this, let me know, as I’d love to further consolidate my setup.
The easiest way to run an OS X VPN server is to get an actual Server license, but there’s also a Macosxhints guide (quite technical) that will guide you through setting it up on a regular OS X Client install. With a VPN, all other local network applications also work, like Apple’s iTunes remote, iTunes music library sharing, LAN games, and much more.
As a bonus, all the traffic that’s sent from your iPhone will also be encrypted, including fetching regular internet content, if you have the option to tunnel all traffic enabled.
Essential tools: Mac OS X Screen Sharing, File Sharing, Remote Login (access through Sharing preferences), Transmission for Bittorrent downloading, PS3MediaServer or Medialink for UPnP media sharing, iTunes Library sharing for music, Front Row with alias folders, iStat for remote system monitoring, Temperature Monitor for more fine-grained control, InsomniaX for keeping laptops awake, Mac OS X Server or other tools for setting up a VPN.
Feel free to add your own tips and setups in the comments.