ubuntu18.04 编译安装 netatalk3.1.11

编译

(编译可以在另一台ubuntu18.04上进行) 安装编译环境

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  

设置变量

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  

编译完成后会生成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,后来发现一直运行不起来)

[Global]
mimic model = TimeCapsule6,106  
log level = default:warn  
log file = /var/log/afpd.log  
spotlight = no  
[TimeMachine]
path = /data/timemachine(timemachine储存路径)  
valid users = username(用户名)  
time machine = yes  
vol size limit = 2000000  

打开netatalk服务并设置开机自启动

sudo systemctl daemon-reload  
sudo systemctl enable netatalk  
sudo systemctl start netatalk  

到此已经安装完成


查看服务状态

systemctl status avahi-daemon  
systemctl status netatalk

/usr/local/sbin/netatalk -V
/usr/local/sbin/afpd -V

脚本部分引用 davecoutts的gist