Setting up a Mac server


Since the Mac is built on a Unix kernel, they make great servers, especially for homes and small offices. This is particularly true because the administration tools (in System Preferences) are especially well designed and easy to use, even for regular folks who aren't tech geeks. The Unix foundation means that Mac servers are not only reliable and secure, but also very friendly with all major operating systems, notably Windows (and Unix too). Apple's Bonjour network service makes connecting other Macs to your server extra easy.

In addition, Mac minis make great servers. They are small and use very little power. Apple claims that the current Mac minis are the most power efficient desktop computers, and this is true for older models as well, as confirmed by PC Magazine and c|net in 2009, plus AnandTech in 2010. If you have an old Mac mini lying around, underutilized since it can't run Lion, setting it up as a print or file server is a great option to put it back into service.

Apple also offers specialized server versions of Mac OS X, but these configurations are targeted at small to medium sized businesses. For the typical home installation, or for many small businesses, you can use the basic "consumer" version of OS X to run your file, print or media server. If you are managing several Mac servers, you may want to invest in Apple's Remote Desktop management software, but this article shows you how to set up your Mac server so you can administer it remotely with the software you already have.

What can I do with my Mac server?
With your Mac server, you can:

  • share printers and files with computers of all types. 
  • share your iTunes library with other Macs and iOS devices. 
  • create an "intranet" web server to share web pages over your local network, or even set up a "public" web server
  • share a scanner, CD and DVD drives, and Bluetooth devices.
  • use the Mac as a router to give multiple computers access to the Internet through a single connection.


All of these options are available in the Sharing panel in System Preferences. This article does not cover the specific details of how to configure each Sharing service, but instead covers the basics of setting up any Mac as a server of any kind. Ideally, your Mac server should be:

  • secure
  • reliable
  • easy to maintain from another computer
  • optimized to support whatever Sharing services you want to activate. 

This article shows you how to set up a Mac to achieve these goals. I used System 10.6 as the basis of these instructions, since 10.6 works with most Intel based Mac minis built in the last five years (unlike 10.7) and also uses less RAM than Lion, but these instructions will also work with any version of OS X, with minor modifications.

Sharing Essentials

If possible, start by doing a "clean install" of OS X, and make sure that all the Software Updates are installed. This ensures that the Mac is secure, and that you aren't running any unnecessary software in the background to the detriment of your server's performance.

To get started, set up a dedicated administrator account that you will use to configure the computer, install updates, and software. Give the account a short Account name, like "admin," and a short but secure password (8 characters or less) if you want to connect to the server using other VNC clients besides Apple's Screen Sharing. Set this account as an Administrator. If you create other accounts on this computer, set them up as Standard users.

Sharing

Open System Preferences and select Sharing. Set the computer name to something short and memorable. For example, the Mac mini we use as a print server is called "miniprinter" Notice how I don't use any spaces in the name -- this isn't required, but makes typing the name a little easier on the command line.

Turn on: Screen Sharing and Remote Login. For both, Allow access for: Administrators. These services allow you to administer and configure the server from another computer, so you can place somewhere out of the way (for example, next to your cable modem or your printer) and not have to visit the server in person every time you want to use it. You can even remove the keyboard, mouse, and monitor from your server after you've set it up.

Here on the Sharing panel, you can turn on other services, such as File Sharing, Printer Sharing, Web Sharing, and so forth. As noted before, this article doesn't cover the specifics of these services, but once you set up Screen Sharing, you can turn other services on and off from any other Mac on the network (or even a Windows or Unix computer, or an iOS device, if you have a VNC client).
Screen Sharing tip: Go to System Preferences > Displays and select a smaller resolution, like 1024 x 768, to make it easy to fit the shared screen window on your notebook or iPad screen. To increase clarity of the display when you connect from another Mac, select View > Turn Scaling Off
Security

Your server should spend most of its existence parked at the login screen. This means the server is secure, because unauthorized users can't log in and mess it up, unintentionally or otherwise. Also, the login screen uses less RAM than logging into a desktop account, because you don't load all the desktop software (like the Dock and the Finder). Note that you don't need to log in to use any of the Sharing services, either. To set this up, open the Security panel in System Preference, and:

  • Disable automatic login 
  • Require a password to unlock each System Preferences pane 
  • Log out after (60) minutes of inactivity (or less) 
  • Disable remote control infrared receiver

The last option means you can't control the server with one of those little white Apple Remotes.

Screen Saver

The best way to save your screen is to turn it off. Screen savers tend to hammer the CPU, and therefore burn unnecessary power and CPU cycles, which will only make your server sluggish and unresponsive. For notebooks and desktop workstations, a screen saver is a great way to "lock" the computer to prevent unauthorized access if you step away from your desk (or worse, if your computer is stolen). For a server, the absolute best option, for computers like the mini, is to disconnect the monitor altogether after you've finished the initial installation configuration, and then use Screen Sharing or Remote Login to control and configure the server. Remember, your server should be sitting at the login screen by default (see the Security section above for details) so you don't need to lock it up.

To avoid using the Screen Saver, select: Start screen saver: Never on the slider control on the Screen Saver tab.

Energy Saver

If you want to take advantage of Apple's excellent power management options, you will need to tweak the Energy Saver settings. Even more significan, some of these options will affect whether you can control the server from another computer. Important: some of these settings depend on whether your server is connected to the network with a wire (Ethernet) or via Wifi.

Start by setting:

  • Display sleep: 10 min (or less)

Turn on:

  • Put the hard disks(s) to sleep when possible 
  • Allow power button to put the computer to sleep 
  • Start up automatically after a power failure

If your Mac is connected to your LAN with a wired (Ethernet) connection, also select:

  • Wake for Ethernet network access

Most of the time, you don't want your server to go to sleep, but for some uses, where you only need to use the server occasionally, you can automatically sleep the computer by setting

  • Computer sleep: 3 hrs (or less)

You can then wake up the Mac with a program such as WakeOnLan. This only works if the server is connected to the router with a Ethernet cable.

If the Mac is connected to your LAN via WiFi, you can't wake it remotely. In this case, turn off:

  • Wake for Ethernet network access

For all Wifi connected servers, any for any server that you want available at any time, set:

  • Computer sleep: Never

Suggested for computers that can't be set to auto-sleep: Set a display sleep time to the lowest amount practical. 10 minutes is a good option, or less if your server won't be connected to a display (this is possible with a Mac mini, for example).

To save (even more) power, use the [Schedule] button to automatically Start up and Shut down the computer when you know you won't need it (for example, between 11 PM and 8 AM).

Software Update

Check for updates: Weekly (or Daily); Download updates automatically. Not that you still have to log in to your administrator account to install the updates.

Testing your configuration

When you are done with these steps, log out. Go to another Mac and try to connect with Screen Sharing. Then, connect using ssh via the Terminal. Restart the server remotely and make sure you can still connect. Finally, if your server is configured to auto-sleep, manually sleep the computer, using the power button, or the Sleep button on the login screen, or the Sleep option from the Apple menu, and then ensure you can wake it up from another computer, and log in with Screen Sharing or ssh.

If all these tests work, you can shut down your server, remove the monitor, keyboard, and mouse, then restart. Your server is ready to use!

Comments

Popular Posts