准备两台机器,此处lsx02(192.168.1.12)服务端、lsx01(192.168.1.226/24)客户端。
lsx02(192.168.1.12)服务端 yum install -y nfs-utils rpcbind //客户端也需安装nfs-utils包
lsx01(192.168.1.226/24) yum install -y nfs-utils
服务端 vim /etc/exports //加入如下内容 /home/nfstestdir //分享的出去的目录。比如A机器分享给BC机器,那分享的目录要一样 192.168.133.0/24(rw,sync,all_squash,anonuid=1000,anongid=1000) //定义分享给哪些机器及其选项。
[root@server ~]# systemctl reload nfs
保存配置文件后,执行如下准备操作
[root@lsx03 ~]# netstat -ltnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2003/master
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1155/sshd
tcp6 0 0 ::1:25 :::* LISTEN 2003/master
tcp6 0 0 :::111 :::* LISTEN 1/systemd
mkdir /home/nfstestdir chmod 777 /home/nfstestdir systemctl start rpcbind //(rpc已经启动可以省略) systemctl start nfs systemctl enable rpcbind //开机启动(客户端省略) systemctl enable nfs //开机启动(客户端省略) systemctl disable nfs //取消开机启动
















