歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> CentOS 6.x 實現NFS共享

CentOS 6.x 實現NFS共享

日期:2017/3/6 9:46:32   编辑:學習Linux

CentOS 6.x 實現NFS共享


CentOS 6.x 實現NFS共享


網絡環境:
一台Linux server ip 192.168.1.254,一台Linux client ip 192.168.1.100
操作系統:CentOS 6.5
需求描述:
1:將/root 共享給192.168.93.129,可寫、同步,允許客戶機以root權限訪問
2:將/var/www/html 共享給192.168.93.0/24網段,可寫、異步

步驟:
1:查看nfs程序是否安裝

[root@server ~]# rpm -qa |grep nfs 查看nfs是否安裝nfs-utils-1.2.3-39.el6.i686[root@server ~]# rpm -qa |grep rpcbind 查看RPC是否安裝rpcbind-0.2.0-11.el6.i686

2:啟動服務並設為開機啟動

[root@server ~]# service nfs start[root@server ~]# service rpcbind start[root@server ~]# chkconfig rpcbind on[root@server ~]# chkconfig nfs on

3:開啟相應端口

iptables  -I INPUT -p tcp --dport 111 -j ACCEPTiptables  -I INPUT -p udp --dport 111 -j ACCEPTiptables  -I INPUT -p tcp --dport 2049 -j ACCEPTiptables  -I INPUT -p udp --dport 2049 -j ACCEPTiptables  -I INPUT -p tcp --dport 30001:30004 -j ACCEPTiptables  -I INPUT -p udp --dport 30001:30004 -j ACCEPTservice iptables saveservice iptables restart

4:編輯配置文件實現需求1,2要求

[root@server ~]# vim /etc/exports/root 192.168.93.129(rw,sync,no_root_squash)/var/www/html 192.168.93.0/24(rw,async)

5:重啟服務

[root@server ~]# service nfs restart[root@server ~]# service rpcbind restart

6:服務器端設置/var/www/html本地寫權限

[root@server ~]# chmod o+w /var/www/html

7:客戶機測試

[root@client ~]# mkdir -p /data/root[root@client ~]# mount 192.168.93.128:/root /data/root/[root@client ~]# mkdir -p /var/www/html_client[root@client ~]# mount 192.168.93.128:/var/www/html /var/www/html_client[root@client ~]# mount |tail -2

http://xxxxxx/Linuxjc/1134282.html TechArticle

Copyright © Linux教程網 All Rights Reserved