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 ACCEPT
iptables  -I INPUT -p udp --dport 111 -j ACCEPT
iptables  -I INPUT -p tcp --dport 2049 -j ACCEPT
iptables  -I INPUT -p udp --dport 2049 -j ACCEPT
iptables  -I INPUT -p tcp --dport 30001:30004 -j ACCEPT
iptables  -I INPUT -p udp --dport 30001:30004 -j ACCEPT
service iptables save
service 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
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值