OSX Time Machine Ubuntuサーバ

Ubuntu16.04サーバにNetatalkをインストールすることでOSX Time Machineのサーバとしても利用することができます。NetatalkはAppleのAFPプロトコルによるオープンソースのファイルシェアサーバです。
標準リポジトリでは最新のものが提供されていないためソースからコンパイルするかPPAを導入します。

ソースからのコンパイル
以下のサイトを参照してください。開発ツールの導入やコンパイル時の条件設定など初心者には敷居が高いため次のPPAの導入をお勧めします。
http://netatalk.sourceforge.net/wiki/index.php/Install_Netatalk_3.1.11_on_Ubuntu_16.04_Xenial

PPAの導入
PPAによるパッケージの検索

上記サイトで検索した結果から以下を採用。

sudo add-apt-repository ppa:sico/netatalk
sudo apt-get update

netatalkのインストール

sudo apt-get install netatalk

netatalk -V と afpd -V でバージョンなどを確認します。現時点での最新バージョンは3.1.11です。

netatalk -v

netatalk 3.1.11 - Netatalk AFP server service controller daemon

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version. Please see the file COPYING for further information and details.

netatalk has been compiled with support for these features:

      Zeroconf support:	Avahi
     Spotlight support:	Yes

                  afpd:	/usr/sbin/afpd
            cnid_metad:	/usr/sbin/cnid_metad
       tracker manager:	/usr/bin/tracker daemon
           dbus-daemon:	/usr/bin/dbus-daemon
              afp.conf:	/etc/netatalk/afp.conf
     dbus-session.conf:	/etc/netatalk/dbus-session.conf
    netatalk lock file:	/var/lock/netatalk

afpd -v

afpd 3.1.11 - Apple Filing Protocol (AFP) daemon of Netatalk

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version. Please see the file COPYING for further information and details.

afpd has been compiled with support for these features:

          AFP versions:	2.2 3.0 3.1 3.2 3.3 3.4 
         CNID backends:	dbd last tdb mysql 

              afp.conf:	/etc/netatalk/afp.conf
           extmap.conf:	/etc/netatalk/extmap.conf
       state directory:	/var/lib/netatalk/
    afp_signature.conf:	/var/lib/netatalk/afp_signature.conf
      afp_voluuid.conf:	/var/lib/netatalk/afp_voluuid.conf
       UAM search path:	/usr/lib/netatalk//
  Server messages path:	/var/lib/netatalk/msg/

/etc/netatalk/afp.confを編集します。

sudo pico /etc/netatalk/afp.conf

[username1]
path = /home/username1
rolist = username1

[TimeMachine]
path = /mnt/timemachine
time machine = yes
; Set volume size to 10000 (10GB)
vol size limit = 10000
valid users = username1
spotlight = no

Ubuntuサーバ側のユーザusername1を指定します。username1にのみTime Machineへのアクセス権を付与します。
username1は予めUbuntuサーバ側に登録しているユーザです。
path = /mnt/timemachine も任意ですがユーザusername1によるアクセス権を付与します。

sudo mkdir /mnt/timemachine
sudo chown -R username1:username1 /mnt/timemachine

avahi-daemonをインストールします。

sudo apt-get install avahi-daemon

NetatalkとAvahi-daemonを再起動してOSXからTime Machineディスクの選択をして下さい。

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

アプリの一時停止(サービスコントロール)、完全停止(システムコントロール)のコマンドは以下参照。

There are services that can be enabled/disabled using the GUI (like the startup application) or the terminal.

For the Terminal you have several options. First, open a terminal (Type “terminal” in the dash, for example, and open it). Then:

Temporary enabling/disabling services

To stop and start services temporarily (Does not enable / disable them for future boots), you can type service SERVICE_NAME. For example:

sudo service apache2 stop (Will STOP the Apache service until Reboot or until you start it again).
sudo service apache2 start (Will START the Apache service assuming it was stopped before.).
service apache2 status (Will tell you the STATUS of the service, if it is either enabled/running of disabled/NOT running.).
sudo service apache2 restart (Will RESTART the service. This is most commonly used when you have changed, a config file. 

In this case, if you changed either a PHP configuration or an Apache configuration. Restart will save you from having to stop/start with 2 command lines)
service apache2 (In this case, since you did not mention the ACTION to execute for the service, it will show you all options available for that specific service.) This aspect varies depending on the service, for example, with MySQL it would only mention that it is missing a parameter. For other services like networking service it would mention the small list of all options available.
SYSTEMD

Starting with Ubuntu 15.04, Upstart will be deprecated in favor of Systemd. With Systemd to manage the services we can do the following:

systemctl start SERVICE - Use it to start a service. Does not persist after reboot

systemctl stop SERVICE - Use it to stop a service. Does not persist after reboot

systemctl restart SERVICE - Use it to restart a service

systemctl reload SERVICE - If the service supports it, it will reload the config files related to it without interrupting any process that is using the service.

systemctl status SERVICE - Shows the status of a service. Tells whether a service is currently running.

systemctl enable SERVICE - Turns the service on, on the next reboot or on the next start event. It persists after reboot.

systemctl disable SERVICE - Turns the service off on the next reboot or on the next stop event. It persists after reboot.

systemctl is-enabled SERVICE - Check if a service is currently configured to start or not on the next reboot.

systemctl is-active SERVICE - Check if a service is currently active.

systemctl show SERVICE - Show all the information about the service.

sudo systemctl mask SERVICE - Completely disable a service by linking it to /dev/null; you cannot start the service manually or enable the service.

sudo systemctl unmask SERVICE - Removes the link to /dev/null and restores the ability to enable and or manually start the service.