Cent OS6.2 and Netatalk 2.2.0

This is a guide on how to install Netatalk 2.2.0 onto CentOS 6.2.  There’s plenty of other guides out there, but unfortunately they all have existing problems.  Either they are not current for the existing software or they are for different platforms of Linux.  This guide is designed for someone of novice skill level to take a fresh install of Cent and get AFP home directories working.  Adding other file shares or time machine disks are easy and other existing guides cover those topics just fine.  This entire guide assumes that no GUI has been installed and all commands will be given through the CLI.  All commands will be italicized.

PRE-Installation

To begin I am going to assume that you have Cent installed and updated.  Also I will assume that you have a user besides root, who will be referred to as bob from now on, that is in the sudoers file.

The first step is to create another user called mockbuild.  This is for building the needed RPM.  The Cent team highly recommends that you install all software through RPMs instead of source installs for optimal compatibility.

[bob@machine ~]$ sudo useradd -u 10000 -M -s /sbin/nologin mockbuild

Next we will install the required dependencies to build the RPM.

[bob@machine ~]$ sudo yum install {openssl,pam,db4,libgcrypt,avahi,libacl,openldap,cracklib,quota,tcp_wrappers}-devel libtool avahi rpm-build

Next we’ll create the RPM build directories.

[bob@machine ~]$ mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}

[bob@machine ~]$ echo ‘%_topdir %(echo $HOME)/rpmbuild’ > ~/.rpmmacros

EDIT:  Sometimes the second line fails if you do a direct copy and paste.  If it gives you an error message just delete both ‘ and readd them in the command line.

Next we need to download the netatalk source file.  The newest version, as of this writing, is 2.2.2.  However the only source file they have is for el6 which is Red Hat Enterprise Linux version 6.  This version uses systemctl instead of init.d for loading and unloading services.  CentOS 6 still uses the older version instead of the newer one.  So we need to find sources for Fedora 15 and less.

[bob@machine ~]$ wget http://kojipkgs.fedoraproject.org/packages/netatalk/2.2.0/2.fc15/src/netatalk-2.2.0-2.fc15.src.rpm

Next is to begin building the RPM.

[bob@machine ~]$ rpm -ivh netatalk-2.2.0-2.fc15.src.rpm

[bob@machine ~]$ cd ~/rpmbuild/SPECS

[bob@machine SPECS]$ rpmbuild -ba ./netatalk.spec

[bob@machine SPECS]$ cd ../RPMS/x86_64

If all went well when you ls in this directory you should see two RPMS.  A dev one and a normal one.

Installation

This part is pretty easy as it’s only one line.

[bob@machine x86_64]$ sudo rpm -ivh netatalk-2.2.0-2.el6.x86_64.rpm

This should have created a directory /etc/netatalk and a service in /etc/init.d/ called netatalk.  The default settings should be sufficient to test whether netatalk is working correctly or not, but part of making AFP, AFP is it shows up in the finder side bar.  So there’s a couple of files that still need to be tweaked.  First we need to add the AFP port to iptables.

[bob@machine x86_64]$ sudo vi /etc/sysconfig/iptables

After the line that accepts the SSH port add:

-A INPUT -m state –state NEW -m tcp -p tcp –dport 548 -j ACCEPT

Reload iptables so the changes take effect.

[bob@machine x86_64]$ sudo service iptables restart

Next we need to edit the avahi services directory to allow AFP to show up with bonjour.

[bob@machine x86_64]$ sudo vi /etc/avahi/services/afpd.service

The file will be a new file.  Just add this text in the file.  One thing to note is that I use Xserve as the model.  I prefer to use Apple’s server icon for servers, but you can choose any of the these options: Macmini, iMac, MacPro, Xserve, MacBook, MacBookPro or MacBookAir

<?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>

That completes the basic installation for the service.  Next is to turn everything on and make sure they stay on after a reboot.

[bob@machine x86_64]$ sudo chkconfig netatalk on

[bob@machine x86_64]$ sudo chkconfig avahi-daemon on

[bob@machine x86_64]$ sudo service avahi-daemon start

[bob@machine x86_64]$ sudo service netatalk start

You should now have a working installation of netatalk 2.2.0 for CentOS 6.2.  This version of netatalk will work with Lion versions of OS X.  Special thanks to these websites for bringing the majority of this content:

http://wiki.centos.org/TipsAndTricks/UsingNetatalk

http://missingreadme.wordpress.com/2010/05/08/how-to-set-up-afp-filesharing-on-ubuntu/

http://www.trollop.org/2011/07/23/os-x-10-7-lion-time-machine-netatalk-2-2/

About these ads

About rathelm
IT Consultant

18 Responses to Cent OS6.2 and Netatalk 2.2.0

  1. Dave Ovad says:

    Rath,

    I know that you say this install is compatible with Lion but I was under the impression that at least Netatalk 2.2.1 was necessary for Time Machine to work properly. By chance have you used 2.2.0 with Time Machine?

    Thanks for posting this…
    Dave

  2. David Noble says:

    Sounds good, but the build fails on my machine. Do you know what’s going on here?

    + ‘[' lib64 '!=' lib ']‘
    + find . -name Makefile
    + xargs perl -pi -e s,-L/usr/lib,-L/usr/lib64,g
    + find . -name Makefile
    + xargs perl -pi -e s,-L/lib,-L/lib64,g
    + make -j4 all
    /var/tmp/rpm-tmp.au4krE: line 75: make: command not found
    error: Bad exit status from /var/tmp/rpm-tmp.au4krE (%build)

    • rathelm says:

      My blog was done on 64 bit CentOS. It looks like you’re on 32 bit. You’d have to go to the 32 bit directory instead of x86_64. However the EPEL install is easier and you should be able to do that just fine.

  3. Mike Stroven says:

    Thanks for the great info. I just noticed that Netatalk 2.2.2 now includes a command line option for –enable-redhat-systemd

  4. moogsoft says:

    Awesome tutorial for the linux novice – thanks! Mike

  5. Craig says:

    Thanks for the guide. It was going great until it tried to build the RPMS, then I got this:

    + ‘[' lib '!=' lib ']‘
    + make -j2 all
    /var/tmp/rpm-tmp.wsYAnz: line 78: make: command not found
    error: Bad exit status from /var/tmp/rpm-tmp.wsYAnz (%build)

    Fresh 32-bit CentOS install.

  6. Nello says:

    Dear Rath,

    I just followed this tutorial, step for step. Thank you so much, you saved me hours of heartache.

  7. rwall says:

    Thanks for the post. Exactly what I was looking for. BTW: I have this set up on a 32-bit machine and did not have any issues. The only difference I found was the .rpm file was put in ~/rpmbuild/RPMS/i386 instead of ~/rpmbuild/RPMS/x86_64.

    • rathelm says:

      That’s correct. I should have pointed that out in the setup guide. Also this is the long way. For CentOS the EPEL has netatalk as a package you can use yum to install.

  8. Adam White says:

    Thanks very much for the great guide, it was exactly what I was looking for.

    Just FYI, I also had to “yum install make” in order to run rpmbuild on 64bit CentOS release 6.3 (Final)

    Keep up the good work.

  9. David Noble says:

    Where’s the yum repo for netatalk 3.0.1?

  10. Pingback: Installing Apple Nattalks on a PC running Linux CentOS 6.3 |

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: