Tuesday, May 29, 2007

在Mac上使用NFA

第一步:启动NFS Server

The tools to get NFS up and running are built-in to every copy of Mac OS X but their configuration can be a little arcane, so I'm going to describe how NFS can be set up using a little utility called "NFSManager" by Marcel Bresink. NFSManager comes in the form of an 826KB download, and the demonstration version of the program is fully functional.

本地下载:NFSManager.dmg

Perhaps Marcel's own description best describes what NFSManager is and does:

NFSManager is a small tool for easy access to the NFS features of Mac OS X. As an operating system with a Unix core, Mac OS X is able to support the Network File System (NFS) protocol according to internet specification RFC 1094. NFS is the accepted industry standard for sharing files between Unix systems.Although NFS is a built-in component of Mac OS X, users cannot access this feature without special knowledge and use of the command-line. NFSManager solves this problem by providing an easy-to-use Aqua interface for the definition of NFS connections.

There are two pieces of NFS terminology that we'll need to be familiar with before we continue: "mounts" and "exports". Mounts are folders or files that we retrieve from other machines on the network and which we access from the local machine. To create and use mounts we will be using an NFS client. Exports are folders or files that we make available to other machines on the network. To create and share exports we will be using an NFS server. Both client and server are included with Mac OS X.

Setting up an export

Setting up an export is quite easy with NFSManager. After clicking on the padlock and entering our administrator password we just use the "Add" button under the "Exports" pane. Most of the options in the ensuing dialog are self-explanatory. We select the item that we wish to share across our network. We can choose to make it available to any machines (this is called sharing with the "world") or we can specify particular machines or subnets. We can also opt to change the user access privileges by granting root access (universal, read-everything privileges) or running as user "nobody" (for restricted access privileges). We can grant write access if we so desire, or keep things "read only". Finally we can export entire filesystems at a time if we wish.

Once we've set things up we just close the export window and save the changes.

Setting up a mount

Establishing a mount is much the same as creating an export. We once again use the "add" button, this time under the "Mounts" pane. Under "Directory to import" we enter a description of the server and share that we wish to mount of the form: "server:/share". As an example, if I want to share the "/home" directory from an NFS server on my network located at "192.168.0.1" then I will enter the following string in the space provided:
192.168.0.1:/home

There are two ways of setting up mounts. If we set them up using the "Display as server connection" option then we'll have to reboot in order to see them. They will appear in the Finder under "Network/Servers". Alternatively, we can specify "Static Mounts" and these will appear without a reboot. In this case we need to specify a path were we wan the files to appear. The default path is "/mnt".

Conclusion

Once you've set up your mounts and exports you need only select "Activate changes" from the NFS menu in NFSManager. Your static mounts and exports will become instantly available. It's beyond the scope of this article to talk about how to set up other Unix boxes on your network -- the steps required will vary depending on the OS in use; Linux, FreeBSD, Solaris, or others.

It is quite easy nevertheless to test out your Mac OS X setup by connecting to another Mac OS X machine nearby, or easier still, by using the "localhost" feature of Mac OS X. Using this feature you can run an NFS server on your own machine and connect to it from that same machine by specifying "localhost" as the server when preparing a Mount. For example, in testing my own machine I exported my "Library" folder and then mounted it over NFS by specifying "localhost:/Library" when I added the mount. Having verified that this was working I was then able to go to another machine on my network -- a FreeBSD server -- and mount the Library folder on that machine too.

Thanks to the power of NFS, Mac OS X is interoperable with an entire flotilla of Unix operating systems in a way that was never possible under Mac OS 9. Steve Jobs's announcement that SMB capabilities will be built into Mac OS X 10.1 is another critical support in making Mac OS X the most advanced operating system in the world today. And all this from an operating system that is still in its beginning stages -- imagine what we'll be able to do five years from now...

Above from: http://www.macobserver.com/tips/hotcocoa/2001/20010723.shtml

Another useful link: http://mactechnotes.blogspot.com/2005/09/mac-os-x-as-nfs-server.html

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home