nfs 配置

时间:2022-06-01 16:35:43

服务端
1.打印系统版本
cat /etc/redhat-release
2.检查并安装NFS服务
rpm -aq nfs-utils portmap rpcbind
yum grouplist
yum groupinstall "NFS file server" -y
rpm -aq nfs-utils portmap rpcbind
3.启动NFS服务
/etc/init.d/rpcbind  start
ps -ef| grep rpc
/etc/init.d/rpcbind  status
rpcinfo -p localhost
/etc/init.d/nfs start
rpcinfo -p localhost
4.设置开机自启动并检查
chkconfig  nfs on
chkconfig  rpcbind on
chkconfig  --list
more /etc/init.d/rpcbind
5.配置共享/data 目录
mkdir /data
ll /etc/exports
vi /etc/exports

#shared data for bbs by liu
/data 192.168.10.0/24(rw,sync)
7.加载NFS服务并检查
/etc/init.d/nfs reload
/etc/init.d/nfs restart
showmount  -e localhost
NFS客户端
1.打印系统版本
cat /etc/redhat-release
2.安装rpc服务并检查
rpm -aq nfs-utils portmap rpcbind
yum install nfs-utils rpcbind -y
rpm -aq nfs-utils portmap rpcbind
/etc/init.d/rpcbind start
/etc/init.d/rpcbind status
3.设置开机自启动并检查
chkconfig  rpcbind on
chkconfig   rpcbind
4.检查服务端的NFS是否OK
showmount  -e 192.168.10.104
5.挂载并测试
mount -t nfs 192.168.10.104:/data /mnt
ll
df -h
cd /mnt/
ll

重启自启动
追加到
echo “mount -t nfs 192.168.10.104:/data /mnt” >> /etc/rc.local
或者fstab