Difference between revisions of "Mac mini NAS"

From LinnDocs
Jump to: navigation, search
(Mac mini with USB drive as NAS)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
__NOTOC__
 
__NOTOC__
== Mac mini with USB drive as NAS ==
 
 
This describes how to setup a Mac mini with an external USB drive as a NAS.
 
This describes how to setup a Mac mini with an external USB drive as a NAS.
  
Line 19: Line 18:
 
** Ensure screen sharing is ON
 
** Ensure screen sharing is ON
 
** Make a note of the address to connect to
 
** Make a note of the address to connect to
 +
[[Image:MacScreenSharing.png]]
 +
 +
 
** In the ''Computer Settings'' dialog
 
** In the ''Computer Settings'' dialog
 
*** Check both the boxes
 
*** Check both the boxes
 
*** Enter password to use for connection
 
*** Enter password to use for connection
IMAGE
+
[[Image:MacVncOptions.png]]
IMAGE
+
 
  
 
* Enable auto-login
 
* Enable auto-login
 
** Preferences -> Personal -> Security & Privacy-> General
 
** Preferences -> Personal -> Security & Privacy-> General
 
** Ensure Disable automatic login is un-checked
 
** Ensure Disable automatic login is un-checked
  IMAGE
+
[[Image:MacAutoLogin.png]]
 +
 
  
 
* Disable ''downloaded from internet'' warning
 
* Disable ''downloaded from internet'' warning
Line 34: Line 37:
 
** Finder -> Applications -> Utilities -> Terminal
 
** Finder -> Applications -> Utilities -> Terminal
 
** Enter the command '''defaults write com.apple.LaunchServices LSQuarantine -bool NO''' and press enter
 
** Enter the command '''defaults write com.apple.LaunchServices LSQuarantine -bool NO''' and press enter
  IMAGE
+
[[Image:MacLSQuarantine.png]]
 +
 
  
 
* Disable sleep mode(s)
 
* Disable sleep mode(s)
 
** Preferences ->Hardware -> Energy Saver
 
** Preferences ->Hardware -> Energy Saver
 
** Set both ''Computer Sleep'' and ''Display Sleep'' to ''Never''
 
** Set both ''Computer Sleep'' and ''Display Sleep'' to ''Never''
IMAGE
+
[[Image:MacEnergySaver.png]]
 +
 
  
 
* Restart Mac and ensure it starts up and logs in without user intervention
 
* Restart Mac and ensure it starts up and logs in without user intervention
Line 63: Line 68:
 
** Disconnect monitor, keyboard and mouse from Mac
 
** Disconnect monitor, keyboard and mouse from Mac
 
** Connect the monitor dongle (described above) to Mac
 
** Connect the monitor dongle (described above) to Mac
 
  
 
* Check operation
 
* Check operation
Line 87: Line 91:
 
** Preferences -> Users & Groups -> Current User -> Login Items
 
** Preferences -> Users & Groups -> Current User -> Login Items
 
** Click ''+'' and select Applications -> Asset
 
** Click ''+'' and select Applications -> Asset
IMAGE
+
[[Image:MacLoginItems.png]]
 +
 
  
 
* Set watched folders
 
* Set watched folders
Line 94: Line 99:
 
** Add the ''Music'' folder on the USB drive
 
** Add the ''Music'' folder on the USB drive
 
** Press the ''Apply'' button
 
** Press the ''Apply'' button
IMAGE
+
[[Image:MacAssetConfig.png]]
  
  
Line 106: Line 111:
 
** Wait for it to fully start up
 
** Wait for it to fully start up
 
** Using Kinsky check that Asset is visible, and audio content shows in library
 
** 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

Latest revision as of 13:09, 24 September 2013


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