09 Jul Make a Mac (Media) Server
Category: Apple, How-To

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.

macmediaserver

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.

Acquiring content


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.

transmission-webinterface

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.

I’ve been trying to make a javascript bookmarklet that lets me paste a URL from my browser and sends it to Transmission via its web interface to start a torrent without actually having to open the web interface, but so far I’ve been unsuccessful. If anyone did manage to make something like this, do let me know.

Serving content


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.

alias-downloads

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.

Nice extra’s


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.)

istat
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.

tempmonotor

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.

laptop

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.

iphonevpn

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.

Roundup


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.

Related:

    Exit Flash

    I'm one of those people who hates Flash with a passion. Not only did it make your Mac browser crash a lot in Leopard, it also used...

    Updates!

    Boy, it's been a while. I really need to update everyone on what's up and what's coming up. - I've been working hard for the Mothership for the...

    Free books for your iPad

    Few people know that the iPad is actually very open when it comes to books. While the only means to purchase books for it is the iBookstore on...

    Cocoaheads WWDC

    It's official: I never had as much giggles in an evening designing this poster for Cocoaheads WWDC. Scott asked me if I'd like to speak at the...

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

25 Responses

  1. 1
    Jim 

    Very interesting. I use an Apple TV, but might set up my old Mac Mini to function as a headless Transmission / UPnP / file sharing with alias server as well. I wish there was a more unified, solution, though.

  2. Wow, I never knew that heat could be such a big issue. This was an interesting article as I was just talking to one of my friends yesterday about getting a server for media/data backup and remote-access.

  3. So your laptop’s lid works now or you got some help from some kind of superglue ;)

  4. 4
    sebastiaan 

    I actually use tape. :(

  5. 5
    LKM 

    Nullriver’s software never really worked for me, it regularly stopped responding. I switched to Rivet, which supports both PS3s and Xboxes and seems to work reliably.

  6. 6
    Richard 

    If you ever feel the need for running a mailserver on your MBP, I remember you had some mail problems before, have a look at http://diymacserver.com

  7. If you’re not aware of it, I prefer to use Caffeine to keep my Macs from sleeping:

    http://lightheadsw.com/caffeine/

  8. Hi Sebastiaan,

    Did you have any luck with using ffmpeg + Apple’s segmenter to transcode and stream video on the fly to your iPhone?

    Cheers,

    Nathan de Vries

  9. so if you like insomia X, please do a better icon for it.. they are actively looking for one

  10. 10
    Travis 

    Great article Sebastiaan. I’ve just recently moved Transmission from my MacBook Pro to a Mac Mini (running plex), and find the web interface is superb for that myself. I actually used Fluid to build a Site-Specific browser for the Transmission Web interface which now sits on my dock the way the native Transmission used to, which is very neat!

  11. 11
    Jim 

    Thank you very much! I’m definately bookmarking this!

  12. 12
    Jacob 

    Where did you get the wallpaper on the Macbook Pro at the top of the article

  13. 13
    sebastiaan 

    Jacob: That’s just a personal customization of my Snow Leopard wallpaper.

  14. 14
    Jacob 

    IS there way you can upload it? I would love to have that?

  15. 15
    Tyler G 

    Adding to what Jacob asked – is there anyway you could share it with the rest of us? It would be a great addition to my LED Cinema Display :)

    I made my own wallpaper that is similar to the one you have above but it is not nearly as polished-looking.

  16. 16
    Ajmaal Firdowzi 

    Hi,

    Thanks a million. this is exactly what I was looking for. I am sure that this will help me.

    I am a banker & I just bought a Mac computer with my bonus performance award I got last week. Its the first time that I am using a Mac operating computer & I didn’t quite understand how to use it properly though I am able to get familiar with the basic operations.
    I was able to find this post on Mac terminal skins – http://www.levoltz.com/2009/08/08/macchanging-skins-of-the-terminal/ but is quite hard & complicated to understand for me. Its the first post that came across for me since I mostly use that blog for information.
    Its a good blog, but then, I found yours & its really great there are so many & topics to discuss. Although its hard for me to understand some things, I guess that this will be a fast track to get familiar Mac operating systems.

    I thank you you for this amazing post. Keep it up. I will keep in touch.

    Thanks again.

  17. 17
    Joram Oudenaarde 

    Hey Sebastiaan, nice post!

    I’m using a Mac Mini with Plex as my mediacenter, and I’m absolutely loving it. I’ve also tried using it as an automated downloadserver with Transmission through the webinterface, but somehow I can’t seem to get it to work properly.

    I have a home-network with a Time Capsule, iMac and Mac Mini, who can all communicate with eachother. The most ideal situation for me would be to simply use the Transmission’s webinterface on my iMac to control the downloads on my Mac Mini.

    How did you set this up, and can you maybe explain that a little? :)

  18. 18
    sebastiaan 

    Ajmaal: Glad to hear you’re using a Mac. Check out TUAW for neat tips on casual Mac use.

    Joram: Just set up Transmission on the Mac Mini, enable the web interface, and copy the IP address with port (for example, 192.168.1.10:8080).

  19. 19
    Joram Oudenaarde 

    Ah, that simple? I should’ve known, hehe.

    Thanks for the tip! By the way, if you like a good geekie-serie, try Eureka ;)

  20. 20
    Jacob 

    I want that picture lol! please post it?

  21. 21
    Kyle 

    I was looking for a way to do a bookmarklet as well, and I think I may have found the answer. Haven’t been able to test it out completely, but I will try it out in the next few days. Until then, here is the link where I found it: http://whoshacks.blogspot.com/2007/12/start-torrent-downloads-from-iphone.html

    It says it is for the iphone, but should be able to modify it for computer use as well.

    Cheers!

  22. 22
    Igwe 

    I want the wallpaper too. please??

  23. 23
    cNone 

    awesome post and even more awesome wall that you have on the top macbook.. care for share ;)
    thanks in advance

  24. 24
    Tony 

    I love the wallpaper on the first image !

    can you upload it please ? THX

  1. [...] Shared Cocoia Blog » Make a Mac (Media) Server. [...]

Trackbacks

  1. Eric Blue’s Blog » Blog Archive » Weekly Lifestream for February 11th
Leave a Reply