注:以10.0.7.154(NFS-Client)机器的/opt/cb/recording目录挂载到 192.168.0.146机器(NFS-Server)上的/usr/local/freeswitch/recordings目录为例。
【NFS-Server端安装与配置(192.168.0.146)】
1)安装
yum install nfs-utils rpcbind
注:可先检查是否安装
yum info nfs-utils
Installed Packages
Name : nfs-utils
Arch : x86_64
Epoch : 1
Version : 1.2.3
Release : 64.el6
Size : 995 k
Repo : installed
yum info rpcbind
Arch : x86_64
Version : 0.2.0
Release : 11.el6
Size : 95 k
Repo : installed
2) 修改配置文件(静态化端口)
#编辑nfs配置文件
vi /etc/sysconfig/nfs
#打开如下屏蔽行
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
STATD_PORT=662
3) 修改防火墙
#往iptables里写入规则,让需要的端口通过
vi /etc/sysconfig/iptables
#增加:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 32803 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 32769 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 892 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 662 -j ACCEPT
4) 重启防火墙
service iptables restart
5)配置挂载目录(/usr/local/freeswitch/recordings )
#编辑配置文件,默认是空的
vi /etc/exports
/usr/local/freeswitch/recordings 10.0.7.0/24(rw,sync,wdelay,root_squash)
#参数详解
ro #只读共享
rw #读写共享
--
sync #同步写操作
async #异步写操作
wdelay #延迟写操作
--
root_squash #屏蔽远程root权限
no_root_squash #不屏蔽远程root权限
all_squash #屏蔽所有远程用户的权限
6)启动服务和检查服务
--
service rpcbind start
chkconfig rpcbind on
--
service nfs start
chkconfig nfs on
【NFS-Client端安装、挂载、配置开启自动挂载(10.0.7.154)】
1) 安装
yum install nfs-utils
注:可先检查是否安装
yum info nfs-utils
Installed Packages
Name : nfs-utils
Arch : x86_64
Epoch : 1
Version : 1.2.3
Release : 64.el6
Size : 995 k
Repo : installed
2)挂载nfs服务器的共享目录到/opt/cb/recordings
mount -t nfs 192.168.0.146:/usr/local/freeswitch/recordings /opt/cb/recording
3)检查是否读取到了服务器的共享文件,不出意外就可以看到有个test文件
ls /opt/cb/recording
4)设置开机自动挂载
echo "192.168.0.146:/usr/local/freeswitch/recordings /opt/cb/recording nfs defaults 0 0" >> /etc/fstab