Project background:
Build NFS network server!!!
Test environment:
VMware Workstation 11
Under the centos6.5 system
Server for NFS: ip:192.168.0.36 iptables off Setenforce 0
NFS Client: ip:192.168.0.39 iptables off Setenforce 0
SECURECRT (SSH remote connection software)
Experimental process:
First, Software Installation
Server-side:
[Email protected]_server02 ~]# Yum install-y nfs-utils rpcbind
Client:
[email protected] ~]# Yum install-y nfs-utils rpcbind
Second, server-side settings:
1, [[Email Protected]_server02 ~]# vim/etc/exports
/home/www 192.168.0.* (Rw,sync,no_root_squash)
Add this line above, save exit!
2. Create Test Catalog
[Email Protected]_server02 ~]# mkdir/home/www
3. Server-side NFS Boot
[[Email Protected]_server02 www]#/etc/init.d/rpcbind Start
Starting rpcbind: [OK]
[[Email Protected]_server02 www]#/etc/init.d/nfs Start
Starting NFS services: [OK]
Starting NFS quotas: [OK]
Starting NFS mountd: [OK]
Starting NFS daemon: [OK]
Starting RPC IDMAPD: [OK]
[[Email Protected]_server02 www]#/etc/init.d/nfslock Start
Starting NFS statd: [OK]
[Email protected]_server02 www]# chkconfig Rpcbind on
[[Email Protected]_server02 www]# chkconfig NFS on
[Email protected]_server02 www]# chkconfig Nfslock on
4, show us the shared directory of mustard set
[Email protected]_server02 www]# showmount-e localhost
Export list for localhost:
/home/www 192.168.0.*
Third, client settings
1. Start the necessary services
[[email protected] ~]#/etc/init.d/rpcbind start
Starting rpcbind: [OK]
[[email protected] ~]#/etc/init.d/nfslock start
Starting NFS statd: [OK]
2. View shared directory information provided to us by NFS server
[Email protected] ~]# showmount-e 192.168.0.36
Export list for 192.168.0.36:
/home/www 192.168.0.*
3. Create a mount point, and then hang the server's shared directory up
[Email protected] ~]# mkdir/home/nfs/
[Email protected] ~]# mount-t NFS 192.168.0.36:/home/www/home/nfs/
[[email protected] ~]# DF
Filesystem 1k-blocks used Available use% mounted on
/dev/sda2 18339256 2910612 14497060 17%/
Tmpfs 502204 502120 1%/DEV/SHM
/DEV/SDA1 297485 34643 247482 13%/boot
192.168.0.36:/home/www 18208256 2918400 14358272 17%/home/nfs
Can see we have succeeded!!!
Simple application: Go to the directory where we mount the client, then create a test file and see if the file we created appears on the server side.
Client for NFS
[Email protected] nfs]# ifconfig >test.txt
[email protected] nfs]# cat Test.txt
Eth0 Link encap:ethernet HWaddr 00:0c:29:97:5d:78
inet addr:192.168.0.39 bcast:192.168.0.255 mask:255.255.255.0
Inet6 ADDR:FE80::20C:29FF:FE97:5D78/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:13460 errors:0 dropped:0 overruns:0 frame:0
TX packets:6304 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8998558 (8.5 MiB) TX bytes:520939 (508.7 KiB)
I just intercepted part of it.
NFS server-side
[[Email Protected]_server02 www]# ls
Test.txt
[Email protected]_server02 www]# Cat Test.txt
Eth0 Link encap:ethernet HWaddr 00:0c:29:97:5d:78
inet addr:192.168.0.39 bcast:192.168.0.255 mask:255.255.255.0
Inet6 ADDR:FE80::20C:29FF:FE97:5D78/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:13460 errors:0 dropped:0 overruns:0 frame:0
TX packets:6304 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8998558 (8.5 MiB) TX bytes:520939 (508.7 KiB)
We can see that we have successfully synchronized, of course, the purpose of NFS server is not limited to this!
Thank you!
This article is from the "Make a few" blog, be sure to keep this source http://9399369.blog.51cto.com/9389369/1753643
centos6.5 on NFS server!!!