CentOS 6.x 实现NFS共享

来源:互联网 发布:域名工信部备案 编辑:程序博客网 时间:2024/05/03 07:25

网络环境:
一台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
0 0
原创粉丝点击