How to quickly set up Time Machine server on Ubuntu Server 12.04 without using extra repositories, unnecessary packages and redundant configuration. Backing up tested on OS X 10.6 Snow Leopard and OS X 10.8 Mountain Lion.
If you need to install a new drive, follow the guide on Ubuntu Help.
1. That’s all you need to install:
sudo apt-get install netatalk avahi-daemon
2. Create a new user for Time Machine, for example, danny:
sudo adduser danny
3. Backup the configuration file:
sudo mv /etc/netatalk/AppleVolumes.default /etc/netatalk/AppleVolumes.default.old
4. Create a new configuration file and open it for editing:
sudo nano /etc/netatalk/AppleVolumes.default
Paste the following line which sets default settings for all shares:
Then add this line to share a folder with danny:
/path/to/shared/folder "Danny's Time Machine" options:tm volsizelimit:300000 allow:danny
Obviously “volsizelimit:300000″ limits the share to 300000 MiB (~314GB). (Finder will show “314GB available” when connected). Remove it if you want.
5. Restart netatalk:
sudo service netatalk restart
6. Connect to your server using Finder (username “danny”). Open System Preferences > Time Machine, click “Select Disk…” and select your server under “Available Disks”:
Once again you’ll be asked for the login and password, after that you can disconnect from the share in Finder if you want, because Time Machine will open a new connection.
* * *
Bonus! Make your server appear as Xserve in Finder:
/etc/avahi/services/afpd.service for editing:
sudo nano /etc/avahi/services/afpd.service
2. Paste this:
<?xml version="1.0" standalone="no"?> <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <service-group> <name replace-wildcards="yes">%h</name> <service> <type>_device-info._tcp</type> <port>0</port> <txt-record>model=Xserve</txt-record> </service> </service-group>
3. Restart avahi-daemon:
sudo service avahi-daemon restart
* * *
If avahi-daemon does not start after rebooting the server (so the server doesn’t re-appear in Finder’s sidebar), change
AVAHI_DAEMON_DETECT_LOCAL from 1 to 0 in
/etc/default/avahi-daemon (more information in my post on ServerFault). Note that if it never appeared in the first place, probably it has a different problem.