Setting Up An NFS Server And Client On Debian Etch
Setting Up An NFS Server And Client On Debian EtchVersion 1.0 This guide explains how to set up an NFS server and an NFS client on Debian Etch. 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 NoteI'm using two Debian systems here:
2 Installing NFSserver: On the NFS server we run: apt-get install nfs-kernel-server nfs-common portmap client: On the client we can install NFS as follows: apt-get install nfs-common portmap
3 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/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
(The no_root_squash option makes that /home will be accessed as root.) Whenever we modify /etc/exports, we must run exportfs -a afterwards 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/home Afterwards, we can mount them as follows: mount 192.168.0.100:/home /mnt/nfs/home You should now see the two NFS shares in the outputs of df -h client:~# df -h and mount client:~# mount
5 TestingOn the client, you can now try to create test files on the NFS shares: client: touch /mnt/nfs/home/test.txt Now go to the server and check if you can see both test files: server: ls -l /home/ server:~# ls -l /home/ ls -l /var/nfs server:~# ls -l /var/nfs (Please note the different ownerships of the test files: the /home NFS share gets accessed as root, therefore /home/test.txt is owned by root; the /var/nfs share gets accessed as nobody, therefore /var/nfs/test.txt is owned by nobody.)
6 Mounting NFS Shares At Boot TimeInstead of mounting the NFS shares manually on the client, you could modify /etc/fstab so that the NFS shares get mounted automatically when the client boots. client: Open /etc/fstab and append the following lines: vi /etc/fstab
Instead of rw,sync,hard,intr you can use different mount options. To learn more about available options, take a look at man nfs To test if your modified /etc/fstab is working, reboot the client: reboot After the reboot, you should find the two NFS shares in the outputs of df -h client:~# df -h and mount client:~# mount
7 Links
|
Join the discussion.
www.seamlessenterprise.com
IP Convergence
Integrate your wireless and wireline networks.
Learn how from the experts at Sprint.
www.seamlessenterprise.com
Wireless & Wireline Integration
Thoughts, strategies and solutions: join the discussion
www.seamlessenterprise.com
Unified Communications 2009
Join the Discussion. Now.
www.seamlessenterprise.com







Recent comments
13 hours 25 min ago
14 hours 53 min ago
18 hours 27 min ago
21 hours 21 min ago
1 day 19 min ago
1 day 1 hour ago
1 day 1 hour ago
1 day 2 hours ago
1 day 3 hours ago
1 day 3 hours ago