Last edited 09/14/2010
This guide explains how to set up an NFS server and an NFS client on OpenSUSE 11.3. NFS stands for Network File System; through NFS, a client can access (read, write) a remote share on an NFS server as if it was on the local hard disk.
I do not issue any guarantee that this will work for you!
1 Preliminary Note
I'm using two OpenSUSE systems here:
NFS Server: server.example.com, IP address: 192.168.0.100 NFS Client: client.example.com, IP address: 192.168.0.1012 Installing NFSserver:
On the NFS server we run:
yast2 -i nfs-kernel-serverThen we create the system startup links for the NFS server and start it:
chkconfig --add nfsserver/etc/init.d/nfsserver start client:
On the client we can install NFS as follows:
yast2 -i nfs-client3 Exporting Directories On The Serverserver:
I'd like to make the directories /home and /var/nfs accessible to the client; therefore we must "export" them on the server.
When a client accesses an NFS share, this normally happens as the user nobody. Usually the /home directory isn't owned by nobody (and I don't recommend to change its ownership to nobody!), and because we want to read and write on /home, we tell NFS that accesses should be made as root (if our /home share was read-only, this wouldn't be necessary). The /var/nfs directory doesn't exist, so we can create it and change its ownership to nobody and nogroup:
mkdir /var/nfschown nobody:nogroup /var/nfs
Now we must modify /etc/exports where we "export" our NFS shares. We specify /home and /var/nfs as NFS shares and tell NFS to make accesses to /home as root (to learn more about /etc/exports, its format and available options, take a look at
man 5 exports)
vi /etc/exports # See the exports(5) manpage for a description of the syntax of this file.# This file contains a list of all directories that are to be exported to# other computers via NFS (Network File System).# This file used by rpc.nfsd and rpc.mountd. See their manpages for details# on how make changes in this file effective./home 192.168.0.101(rw,sync,no_root_squash,no_subtree_check)/var/nfs 192.168.0.101(rw,sync,no_subtree_check)(The no_root_squash option makes that /home will be accessed as root.)
Whenever we modify /etc/exports, we must run
exportfs -aafterwards to make the changes effective.
4 Mounting The NFS Shares On The Clientclient:
First we create the directories where we want to mount the NFS shares, e.g.:
mkdir -p /mnt/nfs/homemkdir -p /mnt/nfs/var/nfs
Afterwards, we can mount them as follows:
mount 192.168.0.100:/home /mnt/nfs/homemount 192.168.0.100:/var/nfs /mnt/nfs/var/nfs
You should now see the two NFS shares in the outputs of
df -hclient:
No comments:
Post a Comment