centos6.5上NFS服务器搭建!!!
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6.5上NFS服务器搭建!!!相关的知识,希望对你有一定的参考价值。
项目背景:
搭建NFS网络服务器!!!
试验环境:
vmware workstation 11
centos6.5的系统下
NFS服务器:ip:192.168.0.36 iptables 关闭 setenforce 0
NFS客户端:ip:192.168.0.39 iptables 关闭 setenforce 0
SecureCRT (ssh远程连接软件)
实验过程:
一、软件安装
服务器端:
[[email protected]_server02 ~]# yum install -y nfs-utils rpcbind
客户端:
[[email protected] ~]# yum install -y nfs-utils rpcbind
二、服务器端设置:
1、[[email protected]_server02 ~]# vim /etc/exports
/home/www 192.168.0.*(rw,sync,no_root_squash)
添加上面这一行,保存退出!
2、创建测试目录
[[email protected]_server02 ~]# mkdir /home/www
3、服务器端NFS启动
[[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、显示出来我们芥菜设置的共享目录
[[email protected]_server02 www]# showmount -e localhost
Export list for localhost:
/home/www 192.168.0.*
三、客户端设置
1、启动必要服务
[[email protected] ~]# /etc/init.d/rpcbind start
Starting rpcbind: [ OK ]
[[email protected] ~]# /etc/init.d/nfslock start
Starting NFS statd: [ OK ]
2、查看NFS服务器提供给我们的共享目录信息
[[email protected] ~]# showmount -e 192.168.0.36
Export list for 192.168.0.36:
/home/www 192.168.0.*
3、创建挂载点,然后把服务器的共享目录挂在上去
[[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 84 502120 1% /dev/shm
/dev/sda1 297485 34643 247482 13% /boot
192.168.0.36:/home/www 18208256 2918400 14358272 17% /home/nfs
可以看到我们成功了!!!
简单应用 :进去客户端我们挂载的目录,然后创建一个测试文件,然后查看服务器端是否出现我们创建的文件。
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)
我只是截取了一部分
NFS服务器端
[[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)
可以看到我们成功的进行了同步,当然NFS服务器的用途不仅限于此!
谢谢大家!
本文出自 “积少成多” 博客,请务必保留此出处http://9399369.blog.51cto.com/9389369/1753643
以上是关于centos6.5上NFS服务器搭建!!!的主要内容,如果未能解决你的问题,请参考以下文章