On the server
- Make directory that you want to use.
- # mkdir /home/sharing
- Edit /etc/exports, insert the client machine's ip
- # vi /etc/exports
- Add this line:
- /home/sharing 192.168.0.3/255.255.255.255(rw,sync)
- Save
- Edit /etc/hosts.allow
- # vi /etc/hosts.allow
- Add this line:
portmap: 192.168.0.0/255.255.255.0
- Save
- Start nfs and portmap
- # /etc/init.d /nfs start
- # /etc/init.d/portmap start
- Start portmap
- # /etc/init.d/portmap start
- Mount the nfs folder
- # mount 192.168.0.1:/home/sharing /mnt
- Check /var/log/messages for any error that might occur
- # tailf /var/log/messages
- Use mount to check if the folder is mounted properly
- # mount
- This should be the output:
- 192.168.0.1:/home/sharing on /mnt type nfs (rw,addr=192.168.0.1)
- Edit /etc/fstab to mount the shared folder on boot
- # vi /etc/fstab
- Add this line
- 192.168.0.1:/mnt/sdb1/backup /mnt nfs rw,hard,intr 0 0
- Save
Doesn't work. I started with a full installation, then used yum to get nfs-utils and nfs-utils-lib. After I follow these instructions, the NFS Daemon always comes up as [Failed].
ReplyDeleteI had trouble starting the nfs service before portmap. When I started portmap first, then the nfs service started with no errors.
ReplyDeleteNSF ver 2 and 3 require portmap service to be running before nfs service can start. If you use NFS ver 4, you don't have to worry about it, because it is not used.
ReplyDelete# Server-side:
ReplyDeleteyum install -y nfs-utils nfs-utils-lib
echo "/home/software 192.168.11.141(rw,sync)" >> /etc/exports
echo "/home/scripts 192.168.11.141(rw,sync)" >> /etc/exports
echo "portmap: 192.168.11.0/255.255.255.0" >> /etc/hosts.allow
exportfs -a -v
for i in nfs portmap; do chkconfig $i on; done
for i in tcp udp; do iptables -A INPUT -p $i -m $i -m multiport --dports 1110,2049 -j ACCEPT; done
iptables-save > /etc/sysconfig/iptables
service portmap start
service nfs start
#
# Client-side:
service portmap start
chkconfig portmap on
cd /
mkdir fx6-share
mount 192.168.11.64:/home/software /fx6-share
# Make it stick:
echo "192.168.11.64:/home/software /fx6-share nfs defaults 0 0" >> /etc/fstab
echo "192.168.11.64:/home/scripts /fx6-scripts nfs defaults 0 0" >> /etc/fstab
mount -a
# EOF
This is an ultimate post. I just tried the steps only one time. And my nfs is well set. But, only one question. --> From the client machine can't I mount the nfs other than /mnt ? I want to mount it as ther server to /home/sharing. Possible ?
ReplyDeleteAnd what option shall I use to get permission from the client to create or delete file in /mnt ?
spisteel@gmail.com
Awesome, this worked great - no fuss - no nonsense - it just works - thank-you very much!
ReplyDeleteOne thing to note: I was getting READONLY mode until I added no_root_squash to the arguments in /etc/exports on the Server.
Got some strange problems while mounting nfs on a ubuntu client machine (mount throw message about wrong filesystem, option, superblock etc). Installing nfs-common solved it. Hope that it will be helpful to someone.
ReplyDeleteGot some strange problems while mounting nfs on a ubuntu client machine (mount throw message about wrong filesystem, option, superblock etc). Installing nfs-common solved it. Hope that it will be helpful to someone.
ReplyDelete