Chinaunix首页 | 论坛 | 博客
  • 博客访问: 179272
  • 博文数量: 32
  • 博客积分: 553
  • 博客等级: 中士
  • 技术积分: 369
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-17 18:18
文章分类

全部博文(32)

文章存档

2015年(1)

2014年(1)

2013年(9)

2012年(9)

2011年(12)

分类: BSD

2012-01-21 20:06:53

Apple AFP filesharing on FreeBSD
原文地址:



On a Mac and have some FreeBSD file-servers around the house of office? Open your file-servers up to easy and fast access via OS X Finder. How? The method is Apple’s native Apple Filing Protocol (AFP), with a bit of help of Apple  Bonjour (mDNSResponder) for automatic discovery and presentation of shared resources on the network.

你是否正在使用Mac 并且周围还有一个基于FreeBSD的文件服务器?如果答案是肯定的那么恭喜你 ,这篇文章就是为你准备的, 配置你的文件服务器以便让Finder高速稳定地访问文件服务器,下面我们就要沿着本文设计的道路达到在FreeBSD实现与MAC OSX共享文件的目的.实现本文需要达成的目标必须使用苹果的AFP协议,苹果文件协议,简称AFP,在苹果Bonjour(mDNSResponder)的帮助下,实现自动发现网络中的服务器并实现网络文件共享的目的.(Bonjour是法语,为苹果公司的服务器搜索协议的商标,mDNSResponder为该协议的一个实现.译者注,注视有可能不是很标准,我也是新手)

The installation and config of the two Ports ‘netatalk’ and ‘howl’ is all there is to it.

首先需要安装平且配置两个新ports软件,netatalk和howl,方法很简单,ports树中,两个软件都是标准卑职.

In a nutshell:

Install the Ports. ‘netatalk’ is the AFP Daemon:

首先安装netatalk, 这是一个AFP的守护文件,只有安装了这个才能使FreeBSD和OSX实现通信.

[martijn@shinobu /usr/ports]$ cd /usr/ports/net/netatalk
[martijn@shinobu /usr/ports/net/netatalk]$ sudo make config


Select the protocol and authentication features you’re planning on using:

首先需要先配置一下协议,然后编译安装,运行命令. sudo make config,一般ports软件都可以通过make config命令进行编译前配置,以便支持一些特别功能,预编译的package有时候编译的选项太过宽松,不适合特别的环境,所以才需要从ports安装特别的软件. 

│ │    [ ] APPLETALK  Enable AppleTalk protocol support 
│ │    [ ] SRVLOC     Enable Service Location Protocol support 
│ │    [X] PAM        Enable PAM support 
│ │    [ ] TIMELORD   Enable Timelord network time service 
│ │    [ ] KRB5       Enable Kerberos V UAM

Install and cleanup:

[martijn@shinobu /usr/ports/net/netatalk]$ sudo make install clean

配置好之后就用make install clean进行软件安装,这个过程是全自动的,系统会帮你处理好一切.

Install the ‘howl’ port for Bonjour or mDNS support.

[martijn@shinobu /usr/ports]$ cd /usr/ports/net/howl 
[martijn@shinobu /usr/ports/net/howl]$ sudo make install clean

安装好netatalk之后就需要安装howl,这个是提供Bonjour 和mDNS支持的一款软件,安装过程和步骤与netatalk是一样的.终端中输入几个命令就可以搞定. 

Add the following to /etc/rc.conf:

netatalk_enable="YES" 
afpd_enable="YES" 
cnid_metad_enable="YES" 
mdnsresponder_enable="YES" 
mdnsresponder_flags="-f /usr/local/etc/mDNSResponder.conf"

紧接着需要修改/etc/rc.conf文件,修改 一些特别的配置,按照以上列出的配置进行更改就可以了.

Create and edit the configuration files.
Netatalk:

[martijn@shinobu /usr/local/etc]$ pwd/usr/local/etc 
[martijn@shinobu /usr/local/etc]$ sudo cp AppleVolumes.default.dist AppleVolumes.default 
[martijn@shinobu /usr/local/etc]$ sudo vim AppleVolumes.default

创建并修改以红色那个列出来的的配置文件.

By default, only user home-directories are shared by netatalk. See the ‘~’ at the end of the file ‘AppleVolumes.default’. Additional, or more generic, shares can be created by adding the to the ’AppleVolumes.default’ file.

默认情况下,netatalk只共享用户本身的home目录,看到配置文件AppleVolumes.default之后,发现文件末尾'~'符号,闲心大家也就了然了.
通常情况下用户可以讲共享目录添加在 'AppleVolumes.default'文件之后,以达到共享用户根目录以为其他目录的目的.

Howl:
Define the services to be announced by Bonjour. First field presents the servername, second the mDNS services, third and last the domain and port-number to be used.

Howl 设置,
定义需要被Bonjour 发布的服务名称,第一列表示服务器的名字,第二列为mDNS服务名,第三列和第四列为域名与需要打开的服务端口号.

[martijn@shinobu ~]$ sudo vim /usr/local/etc/mDNSResponder.conf 
shinobu _afpovertcp._tcp local. 548 
shinobu _ssh._tcp local. 22

As you see, the OpenSSH service can also be announced. Simply by adding the  _ssh._tcp mDNS service.
正如你所见,OpenSSH也可以在mDNS中进行配置.
Startup both ‘netatalk’ and ‘mDNS’:

[martijn@shinobu /usr/local/etc]$ sudo /usr/local/etc/rc.d/netatalk start 
[martijn@shinobu /usr/local/etc]$ sudo /usr/local/etc/rc.d/mdnsresponder start

启用netatalk 和mDNS服务.命令行运行刚刚安装的netatalk和mdnsresponder服务.



Lion setup
Lion 设置:

Now you need to connect to the new drive share and setup Time Machine on your Apple computer to use it.

现在就可以激活Time Machine支持网络驱动器备份,这样就可以通过网络存储Time Machine文件,因为默认只能备份到本地移动磁盘。

First, enable Time Machine to use unsupported drives. Open terminal and run this:

首先,打开Time Machine 支持网络驱动器选项,在终端中键入如下命令:

1
defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

Open Finder. From the menu bar, select “Go” then “Connect to Server”
In the server address, enter:

打开 “Finder”,从菜单栏中选择“Go”, 然后点击“连接服务器”,在弹出的地址对话框中键入以下地址:

1
afp://timemachine@(**your ubuntu machine's domain name or ipaddress**)/

Click connect. Enter username timemachine and the password you entered earlier. The drive should then mount and open.

使用刚才设置的用户名和密码登陆网络驱动器,此时OSX会自动将网络磁盘挂载在本地,这样就可以再Time Machine中使用网络驱动器。

Open Time Machine, and click “Select Disk…” Choose the mounted drive that you just opened. If prompted for credentials, reenter them. Enable Time Machine and the first backup should fire up.

打开 Time Machine 设置以下备份目的地为刚才挂载到系统上的网络磁盘即可,开始我们的Time Machine之旅吧。

阅读(4908) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~