Difference between revisions of "Set up an NFS server"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 1: Line 1:
 
{{factbox|time=10 min|distro=SUSE Linux 10|type=HowTo}}
 
{{factbox|time=10 min|distro=SUSE Linux 10|type=HowTo}}
  
You want to share folders of your computer in the network. So, your computer plays the role of the [[NFS]] [[server]]. The network drives are ''exported'' by the server, that's how NFS calls it. The following is an example how you get a folder ''/public'' that is shared in your network. It uses [[SUSE]] Linux 10, but the process for other distributions should be similar. It will last about 10 minutes. We use ''server'' as [[hostname]] for the computer exporting directories.
+
You want to share folders of your computer in the network. So, your computer plays the role of the [[NFS]] [[server]]. The network drives are ''exported'' by the server, that's how NFS calls it. The following is an example how you get a folder ''/public'' that is shared in your network. It uses [[SUSE]] Linux 10, but the process for other distributions should be similar. We use ''server'' as [[hostname]] for the computer exporting directories.
  
 
To do this,
 
To do this,

Revision as of 01:54, 2 October 2010


Tutorial Factbox

Time to replay 10 min
Example Distro SUSE Linux 10
Type HowTo

You want to share folders of your computer in the network. So, your computer plays the role of the NFS server. The network drives are exported by the server, that's how NFS calls it. The following is an example how you get a folder /public that is shared in your network. It uses SUSE Linux 10, but the process for other distributions should be similar. We use server as hostname for the computer exporting directories.

To do this,

mkdir /public
  • Edit /etc/exports, add the line
/public/   *(rw,no_root_squash,sync)
  • Start the NFS-Server:
/etc/init.d/nfs-user-server start || /etc/init.d/nfsserver start

This command makes sure your nfs server gets started, no matter if your distribution names its startup script "nfs-user-server" or "nfsserver".

Verify the result

Issue on your computer: showmount -e 127.0.0.1. The result will be like this:

Export list for 127.0.0.1:
/public *

By this command, you can see that a share /public is available on your computer, so it is an NFS-Server.

Use the network drive

To use the network drive on a client computer, go there and try if you can reach the NFS server:

ping server

Mount the server's export to (as an example) /mnt/nfs

mkdir -p /mnt/nfs
mount server:/public /mnt/nfs

You can make this mount persistant by using the fstab.

See also