Mac mini NAS

From LinnDocs
Jump to: navigation, search


This describes how to setup a Mac mini with an external USB drive as a NAS.

Hardware

  • Mac mini with Mountain Lion
  • Monitor dongle as described here
  • WD My Passport 2TB USB drive
  • PC/Mac/iPad running a VNC viewer to remotely control the NAS

For initial setup ONLY, a monitor, keyboard and mouse will need to be connected to the Mac


Setup headless server

  • Enable screen sharing
    • Preferences -> Internet & Wireless -> Sharing
    • Enable Screen Sharing service
    • Ensure screen sharing is ON
    • Make a note of the address to connect to

MacScreenSharing.png


    • In the Computer Settings dialog
      • Check both the boxes
      • Enter password to use for connection

MacVncOptions.png


  • Enable auto-login
    • Preferences -> Personal -> Security & Privacy-> General
    • Ensure Disable automatic login is un-checked

MacAutoLogin.png


  • Disable downloaded from internet warning
    • Start terminal
    • Finder -> Applications -> Utilities -> Terminal
    • Enter the command defaults write com.apple.LaunchServices LSQuarantine -bool NO and press enter

MacLSQuarantine.png


  • Disable sleep mode(s)
    • Preferences ->Hardware -> Energy Saver
    • Set both Computer Sleep and Display Sleep to Never

MacEnergySaver.png


  • Restart Mac and ensure it starts up and logs in without user intervention
    • Apple -> Restart


Configure Remote Access

  • Install a VNC viewer on the PC/Mac to be used for remote access
    • On Windows suggest RealVNC
    • On Mac suggest Chicken VNC
    • On iPad there is VNC Viewer for £6.99, but this is untested
  • Open the VNC client and check connection to the Mac
    • Check the Mac is viewable and controllable from the VNC viewer


Check Operation

  • Close VNC viewer (F8 to exit full-screen mode)
  • Shutdown the Mac
  • Make headless
    • Disconnect monitor, keyboard and mouse from Mac
    • Connect the monitor dongle (described above) to Mac
  • Check operation
    • Power up Mac
    • Wait until powered up (after jingle)
    • Connect remotely using VNC viewer as described above

If this can now control Mac then headless operation is correctly setup


Setup Media Server

  • Install USB drive
    • Plug in USB drive and wait for it to be detected
    • Format drive for Mac OSX as described here
    • Create a folder called Music on this drive, to store the audio files
  • Install Media Server
  • Add to automatic startup
    • Preferences -> Users & Groups -> Current User -> Login Items
    • Click + and select Applications -> Asset

MacLoginItems.png


  • Set watched folders
    • Start Asset UPnP
    • Select Configure
    • Add the Music folder on the USB drive
    • Press the Apply button

MacAssetConfig.png


Final Checks

  • Using Kinsky (from any machine on network)
    • Check Asset is listed in the Libraries list
    • Check audio content from USB drive is visible in library
  • Restart
    • Restart the Mac
    • Wait for it to fully start up
    • Using Kinsky check that Asset is visible, and audio content shows in library


Add Disk 'No-Sleep' Functionality

To prevent the USB hard drive from spinning down, which can lead to audio dropout, a utility is run once per minute to write (and flush) to the drive

  • Install the tick.py script (tick.py) in the root of the USB Drive
#!/usr/bin/python 

import time

f = open( '/Volumes/USBDrive1/timestamp.txt', 'at+' )
f.write( time.asctime( time.localtime() ) + '\n' )
f.close()
  • Create the plist file ~/Library/LaunchAgents/com.user.clock.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"    "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.user.clock</string>
    <key>Program</key>
    <string>/Volumes/USBDrive1/tick.py</string>
    <key>StartInterval</key>
    <integer>60</integer>
</dict>
</plist>
  • Add this file to the launchctl executor
launchctl load ~/Library/LaunchAgents/com.user.clock.plist