Author Topic: Setup NFS server/client  (Read 2921 times)

Offline rick0612

  • Sr. Member
  • ****
  • Posts: 258
  • The only dumb question is the one not asked.
Setup NFS server/client
« on: December 21, 2009, 06:44:54 PM »
These steps will get a basic NFS server/client setup going. Security and/or other issues are not addressed. I suggest getting this working then changing things to the way you want. You can always go back to these settings and start over.

Set up an NFS server

Step 1: Create a directory that you will want to use as your shared directory. Make sure permissions for this directory are set for read and write for all users (you may have to be root to change this). If you use a firewall, make sure it allows access to/from the machine/shares you want to export.

NOTE: NFS will only export directories on a local filesystem.  This means if you want to use another partition or second hard drive, you must make sure it is mounted in the 'primary' filesystem (the one NFS is being run from) usually under /mnt. You then export the '/mnt/nfs-share' instead of the partition/drive itself.

Step 2: Open the PCLinuxOS Control Center (PCC) -> "Network Sharing" -> "Share drives and directories using NFS". It may ask you to install the nfs-utils app, go ahead this is a one-time shot. You will then be shown the DrakNFS window.

Step 3: In the DrakNFS window, you have 3 options on the right; Add, Modify, Remove. If this is your first share, select "Add".

Step 4: In the "Directory" window, select the directory you created in step 1.

Step 5: In the "Access" area, go with the ip address with the /8.

Step 6: In the "User ID Mapping" area, use the scroll down choices to pick "map root user as anonymous user" and set the user ID and Group ID areas to one of the choices. (I picked the primary versus anonymous user)

Step 7: Under "Advanced options", you can set the first two options to yes and the last two to "no".

Step 8: Click "OK". Click "OK".

Step 9: Go to PCC -> System -> "Manage system services by enabling and disabling them".
        Check that "On boot" box is clicked for netfs, nfs-common and nfs-server.
        If any of the above services are not already running, click Start.
        Click "OK" when done.

Step 10: To restart the nfs service you can either Reboot or type in a console as root:
        service -f nfs-server (or whatever the server service name is in step 9)
        The above command does a full restart of nfs server including supporting daemons.

That completes the server side setup.

Set up an NFS client

Step 1: On the client PC, open PCC -> "Network Sharing" ->  "Access NFS shared drives and directories". You may be asked to install nfs-utils.

Step 2: In the right-hand pane, click Search servers. Don't panic; you may have to wait a while to get a response.

Step 3: Click on the ip address then the arrow next to the ip address of the server in the left-hand pane. The directory created at the beginning will appear. Click it.

Step 4: At the bottom of the window, click Mount point, type in a different point if you want, then "OK".

Step 5: Click Mount.

Step 6: Click "Done", you will be asked to save /etc/fstab modifications. Click "Yes".

Step 7: Go to PCC -> System -> "Manage system services by enabling and disabling them".
        Check that "On boot" box is clicked for netfs and nfs-common.
        If any of the above services are not already running, click Start
        Click "OK"

Step 8: You can now find the mounted directory in your favorite file manager under the /mnt folder.


Packaging rig: Averatec 2573 /12.1" screen /2.0GHZ /3GB RAM /120GB SSD /Minime 2012.12

Daily rig: Alienware X51 /23" monitor /Windows 7 host /KDE VBox client

Offline jibe74

  • Jr. Member
  • **
  • Posts: 37
Re: Setup NFS server/client
« Reply #1 on: December 28, 2012, 07:28:41 AM »
Hi,

As sometimes you cannot use the GUI, ie if you can only use SSH, here is the way to configure a NFS server by command line :

1 - Be sure to be root. If necessary, use
Code: [Select]
su
2 - Normally, the nfs server package is already installed. If it is not, install it, but unfortunately I don't know the name of the needed package(s) (If somebody knows, please help !).

2 - Type the command
Code: [Select]
drakxservicesthen, navigate down the list using tab and arrow keys and validate those services using the spacebar if they are not already:
  • network-up
  • nfs-server
  • rpcbind

3 - Validate the changes with Ok

4 - reboot. Your ssh connexion will end, but you can re-open it when the computer has restarted. Be just carefull to reboot, not shutdown !!!

5 - When you can access again to the command line, type this command :
Code: [Select]
nano /etc/exportsThen, add the path of your exports. This should be :
/path/to/your/export   authorized_computer1(options), authorized_computer2(options)...

for example :
/home/myexport   *.mydomain.tld(ro)

so, any computer in the mydomain.tld local network will be able to mount your /home/myexport folder read only. See
Code: [Select]
man exportsor this page for more details.

Enjoy !