編譯
(編譯可以在另一臺(tái)ubuntu18.04上進(jìn)行)
安裝編譯環(huán)境
sudo apt install -y \
build-essential \
libevent-dev \
libssl-dev \
libgcrypt-dev \
libkrb5-dev \
libpam0g-dev \
libwrap0-dev \
libdb-dev \
libtdb-dev \
avahi-daemon \
libavahi-client-dev \
libacl1-dev \
libldap2-dev \
libcrack2-dev \
libdbus-1-dev \
libdbus-glib-1-dev \
libglib2.0-dev
安裝checkinstall袋毙,
sudo apt install --yes checkinstall
如果checkinstall安裝失敗就去下載deb包安裝
checkinstall for ubuntu18.04
sudo dpkg -i checkinstall_1.6.2-4ubuntu2_amd64.deb
設(shè)置變量
NETATALK_VERSION='3.1.11'
MAINTAINER='YOUR NAME \<yourname@email.com\>'
下載源碼
wget http://prdownloads.sourceforge.net/netatalk/netatalk-${NETATALK_VERSION}.tar.gz -P /tmp
tar -xzf /tmp/netatalk-${NETATALK_VERSION}.tar.gz -C /tmp
cd /tmp/netatalk-${NETATALK_VERSION}
編譯
./configure \
--with-init-style=debian-systemd \
--without-libevent \
--with-cracklib \
--enable-krbV-uam \
--with-pam-confdir=/etc/pam.d \
--with-dbus-daemon=/usr/bin/dbus-daemon \
--with-dbus-sysconf-dir=/etc/dbus-1/system.d
make
sudo checkinstall -D \
--pkgname='netatalk' \
--pkgversion="${NETATALK_VERSION}" \
--maintainer="${MAINTAINER}" \
make install
編譯完成后會(huì)生成netatalk的deb包
安裝
安裝依賴
sudo apt install -y \
avahi-daemon \
cracklib-runtime \
db-util \
db5.3-util \
libtdb1 \
libavahi-client3 \
libcrack2 \
libcups2 \
libpam-cracklib \
libdbus-glib-1-2
安裝編譯好的包
sudo dpkg -i netatalk_3.1.11-1_amd64.deb
sudo ldconfig
編輯配置文件 /usr/local/etc/afp.conf,(我一開始以為是/etc/afp.conf,后來發(fā)現(xiàn)一直運(yùn)行不起來)
[Global]
mimic model = TimeCapsule6,106
log level = default:warn
log file = /var/log/afpd.log
spotlight = no
[TimeMachine]
path = /data/timemachine(timemachine儲(chǔ)存路徑)
valid users = username(用戶名)
time machine = yes
vol size limit = 2000000
打開netatalk服務(wù)并設(shè)置開機(jī)自啟動(dòng)
sudo systemctl daemon-reload
sudo systemctl enable netatalk
sudo systemctl start netatalk
到此已經(jīng)安裝完成
查看服務(wù)狀態(tài)
systemctl status avahi-daemon
systemctl status netatalk
/usr/local/sbin/netatalk -V
/usr/local/sbin/afpd -V
腳本部分引用
davecoutts的gist