NFS的简单配置与使用

用直接写入配置文件的方式:

 

    NFS服务器的配置文件路径是:/etc/exports

 

一、建立NFS服务器目录

 

    [root@localhost ~] # mkdir /opt/nfsdir

 

二、写入配置文件

 

    [root@localhost ~] # vim /etc/exports

 

    /opt/nfsdir    *(rw,sync,no_root_squash)   # 向配置文件中写入这些内容

 

    :wq #保存退出

 

     说明:

     * 表示所有的客户机都可挂载此目录

     rw 表示权限,即挂载此目录后可对其进行读写操作

     no_root_squash 表客户机以主机的root身份挂载此目录

 

三、启动NFS服务

 

      注意:最好先将防火墙关闭

      [root@localhost ~] # iptables -F #清除所有防火墙规则

      [root@localhost ~] # chkconfig iptables off   #默认不开启防火墙

 

      NFS的启动与关闭相关命令如下:

 

      [root@localhost ~] # service nfs start #启动

      [root@localhost ~] # service nfs stop #关闭

      [root@localhost ~] # service nfs restart #重启

      [root@localhost ~] # chkconfig nfs on #默认开

      [root@localhost ~] # chkconfig nfs off #默认关

 

四、使用NFS

 

      以mini2440为例

      在windows下连接好串口线,网线,配置好超级终端,打开超级终端,从Nandflash启动mini2440,在超级终端中进入系统,挂载NFS目录到/mnt如:

      [root@FriendlyARM /]# mount -t nfs -o nolock 192.148.0.120:/opt/nfsdir /mnt/

      *如挂载不成功,可先ping主机ip看是否能ping通,如无法ping通则说明网络配置不正确,请将两者的ip设置在同一网段,并查看主机防火墙是否关闭,再尝试挂载。

 

      在主机中编写测试程序hellomini2440.c并交叉编译成二进制文件:

      [root@localhost ~] # arm-linux-gcc -o hellomini2440 hellomini2440.c

      然后将得到的可执行文件放入NFS共享目录/opt/nfsdir中

      超级终端下运行该程序:

      [root@FriendlyARM /]# ls /mnt/

      hellomini2440

      [root@FriendlyARM /]# ./hellomini2440

      Hello mini2440!
      [root@FriendlyARM /mnt]#

     

      在Linux下可用minicom进入开发板终端作如同windows下的超级终端的操作

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值