Configuring NFS on Linux

Hello All

I am back with another tutorial on a completely new Topic, that is “Networking”, but Linux is still the same. I will start with basic and teach you How to configure Network File System on Linux system.

I will be using Fedora 14 but this tutorial can be applied to all Linux Systems. and for the first time in history, I will welcome critics as well, So feel free whatever you want to say about my blog. So lets get started.

I will be assuming the Following

– You have Fedora 14 but any other Linux system will also work

– You are logged in as root user thought it is highly discouraged but it makes life easier or you can use su – or sudo

– My Server IP would be 192.168.1.3

– My Client IP would be 192.168.1.4

– You can find your IPs using the Command “#ifconfig -a

Configuring NFS in GUI Mode:

First of all lets install the basic stuff needed for NFS to work.

1. Open “Add and Remove Software” (Fedora) or “Synaptic Manager” (Ubuntu) and search for “nfs-utils“.

2. Select and install them and after installation, a reboot is recommended.

3. Now go to Administration -> Server Sittings -> NFS and launch it

4. From the main tool bar, click the big Plus button, the “Add NFS Share” window will pop up

5. In directory Field browse to the directory you want to Share.

6. Specify the host you want your directories (Files) to share with.

7. Make your choice for the basic permissions whether you want to allow them with Read/write permission or you want to stay with the basics.

8. You can also explore more by clicking the “General Options

– Unchecked “Allow connections from port 1024 and higher” would mean that only root can access this share.

– “Allow insecure locking” would mean simultaneous writing to the file, Not a good idea.

– The rest is pretty self explanatory

9. “User Access” Tab is also pretty self explanatory.

10. Click OK and you are done on the Server side.

11. Now Restart the NFS server for the Changes to take effect

#/sbin/service nfs reload

12. Now the Client Side, First of all make sure that your share is visible to Client by running the Command

#showmount -e 192.168.1.3 (IP in my case)

I got the Error mount clntudp_create: RPC: Port mapper failure – RPC: Unable to receive while I was running showmount command on my client, I solve it by changing my host names, my laptop and PC had the same default names. I will show you how to change your host name through a graphical interface in a while.

13. Now create a directory in /mnt (recommended) by the name “share” (in my case) using the command

#mkdir /mnt/share/

14. Now Run the command

#mount -t nfs 192.168.1.3:/home/waqar/share /mnt/share/

15. And there you, you are done. Easy wasn’t it? 🙂

Configuring NFS Using text Mode:

1. Make sure you have assigned IPs to your Ethernet Cards using the Command (You dont need to do this in case If you are running DHCP)

#ifconfig eth0 192.188.1.3 netmask 255.255.255.0 up

2. The “/etc/exports” file contain information about your share directories, you can add new share points using “vi”

#vi /etc/exports

3. you can add simple entries e.g.

/root/share                    192.168.1.4(rw,sync)

Where:

/home/waqar/share

is the directory I wasn’t to share

192.168.1.4

is the Host IP with which I want to share.

With Read Write and Synchronization enabled

4. The Client part is same as that of graphical mode.

Alternative Method:

1. Just make sure NFS is running

2. You need to Install SSH, You can Do it from Add/Remove software or Synaptic manager depands on whether you are using Fedora or Ubuntu or you can do it through command prompt

#yum -y install openssh-server openssh-clients

3. Start and enable the service

#service sshd start

4. Now to copy files run the simple command

#scp myFile 192.168.1.4:/home/waqar/

alternatively If you want to copy files from other computer to yours, the command can be

#scp 192.186.1.4:/home/waqar/myFile /home/afridi/

Changing Host name using GUI:

1. Go to Launch Menu, Administration -> Network Configuration

2. Click the DNS Tab and in the host Field, change your host name

If I am missing anything or you have any problem, Please leave a comment.

Advertisements

2 thoughts on “Configuring NFS on Linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s