Intro

This is a tutorial about how to make Ubuntu server a Mac Time Capsule. What we need is a functional PC that can install Ubuntu and a Mac machine. This server can be used as not only a file server, but also a Time Machine for Mac backup.

The systems I am using are Ubuntu Server 16.04 LTS and OS X 10.11.5.

Now let’s get it started!

Step 1. Install Ubuntu (Server) 16.04 LTS on your server machine.

Install the LAMP server, OpenSSH server, and Samba file server. Wired network required for the the ubuntu machine for better performance.

I just want to mention this step here, but don’t want to cover the details of how to install those servers (LAMP, OpenSSH, and Samba) - it’s very normal and is not the topic of this post. After the installation finished, you may login the server via your Mac machine.

Below are some optional configurations.

[Optional] Add new user:

$ sudo useradd -c "King the Brave" -m -s /bin/bash King $ sudo passwd sam # you may use this to reset root's password $ sudo usermod -aG sudo King

[Optional] Delete old user

$ sudo userdel -r old_king # with "-r", we can delete the home directory for "old_king"

Step 2. Mount your backup disk on Ubuntu.

$ sudo lshw -C disk # to determine the hard drive information $ sudo fdisk /dev/sda # and create a new partition in the fdisk program by typing "n" $ mkdir ~/Xserve # as a mount point $ sudo mount /dev/sda ~/Xserve # to mount the hard drive

Step 3. Installation/configurations of AFP server.

Update: friend Ivan Tsvetanov mentiones that the AFP protocal is deprecated and “there is currently no sane backup on MacOS and one could do business from it :D” - thank you Ivan Tsvetanov!

$ sudo apt-get install netatalk libc6-dev avahi-daemon libnss-mdns $ sudo vim /etc/nsswitch.conf # to replace the hosts line as below: hosts: files mdns4_minimal [ NOTFOUND = return ] dns mdns4 mdns $ sudo vim /etc/avahi/services/afpd.service # to edit as below: <?xml version = "1.0" standalone = 'no' ?>< ! -- * -nxml- * -- > < ! DOCTYPE service-group SYSTEM "avahi-service.dtd" > <service-group> <name replace-wildcards = "yes" > %h</name> <service> < type > _afpovertcp._tcp</type> <port>548</port> </service> <service> < type > _device-info._tcp</type> <port>0</port> <txt-record>model = Xserve</txt-record> </service> </service-group> $ sudo vim /etc/netatalk/AppleVolumes.default # to edit as below: # change the line ~/ to: /home/<username>/Xserve options:tm $ sudo vim /etc/default/netatalk # to edit as below: # uncomment/ add the entries below: ATALKD_RUN = no PAPD_RUN = no CNID_METAD_RUN = yes AFPD_RUN = yes TIMELORD_RUN = no A2BOOT_RUN = no

Step 4. Restart the services.

$ sudo service avahi-daemon restart $ sudo service netatalk restart

Summary

Check out what we get!

Time Machine

The speed for backup is much slower than using USB or SATA connection of course, but hey, it is wireless! For the first time backup, 100GB may take you 5 hours… but for later backups, it should be acceptable.

Normal file server

In the meantime, it can serve as a normal file server. Just store your photos, music, movies, and other files here! The speed is OK. As I tested, we can play a 1080P movie via the server quite smoothly.

One more thing…

In case you feel the backup frequency is too high that your machine gets slow every hour, you can use TimeMachineEditor to adjust the interval for backup.

References